From 3fea483df8a296a81b21cb0efcd8ea483912864d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 15:42:11 +0200 Subject: [PATCH] test(systemtests): fix failing tests (backport #22145) (#22154) Co-authored-by: Alexander Peters Co-authored-by: Julien Robert --- tests/systemtests/rest_cli.go | 4 ++-- tests/systemtests/system.go | 5 +++++ tests/systemtests/testnet_init.go | 14 ++++++++++++++ tests/systemtests/upgrade_test.go | 4 ++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/systemtests/rest_cli.go b/tests/systemtests/rest_cli.go index a7609949387f..3ad1e30dda68 100644 --- a/tests/systemtests/rest_cli.go +++ b/tests/systemtests/rest_cli.go @@ -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 } diff --git a/tests/systemtests/system.go b/tests/systemtests/system.go index 346f39e761b4..f42bf96a79cd 100644 --- a/tests/systemtests/system.go +++ b/tests/systemtests/system.go @@ -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 diff --git a/tests/systemtests/testnet_init.go b/tests/systemtests/testnet_init.go index bdb2a85d25da..9033c283e43a 100644 --- a/tests/systemtests/testnet_init.go +++ b/tests/systemtests/testnet_init.go @@ -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", diff --git a/tests/systemtests/upgrade_test.go b/tests/systemtests/upgrade_test.go index bd719d1e7962..a2000aeaea1c 100644 --- a/tests/systemtests/upgrade_test.go +++ b/tests/systemtests/upgrade_test.go @@ -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))