Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(systemtests): fix failing tests (backport #22145) #22154

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/systemtests/rest_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ func GetRequestWithHeaders(t *testing.T, url string, headers map[string]string,
defer func() {
_ = res.Body.Close()
}()
require.Equal(t, expCode, res.StatusCode, "status code should be %d, got: %d", expCode, res.StatusCode)

body, err := io.ReadAll(res.Body)
require.NoError(t, err)
require.Equal(t, expCode, res.StatusCode, "status code should be %d, got: %d, %s", expCode, res.StatusCode, body)

return body
}
5 changes: 5 additions & 0 deletions tests/systemtests/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,11 @@ func (s *SystemUnderTest) CurrentHeight() int64 {
return s.currentHeight.Load()
}

// NodesCount returns the number of node instances used
func (s *SystemUnderTest) NodesCount() int {
return s.nodesCount
}

type Node struct {
ID string
IP string
Expand Down
14 changes: 14 additions & 0 deletions tests/systemtests/testnet_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ func NewSingleHostTestnetCmdInitializer(
}
}

// InitializerWithBinary creates new SingleHostTestnetCmdInitializer from sut with given binary
func InitializerWithBinary(binary string, sut *SystemUnderTest) TestnetInitializer {
return NewSingleHostTestnetCmdInitializer(
binary,
WorkDir,
sut.chainID,
sut.outputDir,
sut.initialNodesCount,
sut.minGasPrice,
sut.CommitTimeout(),
sut.Log,
)
}

func (s SingleHostTestnetCmdInitializer) Initialize() {
args := []string{
"testnet",
Expand Down
4 changes: 2 additions & 2 deletions tests/systemtests/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ func TestChainUpgrade(t *testing.T) {
currentBranchBinary := sut.execBinary
currentInitializer := sut.testnetInitializer
sut.SetExecBinary(legacyBinary)
sut.SetTestnetInitializer(NewModifyConfigYamlInitializer(legacyBinary, sut))
sut.SetTestnetInitializer(InitializerWithBinary(legacyBinary, sut))
sut.SetupChain()
votingPeriod := 5 * time.Second // enough time to vote
sut.ModifyGenesisJSON(t, SetGovVotingPeriod(t, votingPeriod))

const (
upgradeHeight int64 = 22
upgradeName = "v050-to-v051"
upgradeName = "v050-to-v052" // must match UpgradeName in simapp/upgrades.go
)

sut.StartChain(t, fmt.Sprintf("--halt-height=%d", upgradeHeight+1))
Expand Down
Loading