Skip to content

Commit 3fea483

Browse files
mergify[bot]alpejulienrbrt
authored
test(systemtests): fix failing tests (backport #22145) (#22154)
Co-authored-by: Alexander Peters <[email protected]> Co-authored-by: Julien Robert <[email protected]>
1 parent 090efc9 commit 3fea483

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

tests/systemtests/rest_cli.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ func GetRequestWithHeaders(t *testing.T, url string, headers map[string]string,
7979
defer func() {
8080
_ = res.Body.Close()
8181
}()
82-
require.Equal(t, expCode, res.StatusCode, "status code should be %d, got: %d", expCode, res.StatusCode)
83-
8482
body, err := io.ReadAll(res.Body)
8583
require.NoError(t, err)
84+
require.Equal(t, expCode, res.StatusCode, "status code should be %d, got: %d, %s", expCode, res.StatusCode, body)
85+
8686
return body
8787
}

tests/systemtests/system.go

+5
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,11 @@ func (s *SystemUnderTest) CurrentHeight() int64 {
766766
return s.currentHeight.Load()
767767
}
768768

769+
// NodesCount returns the number of node instances used
770+
func (s *SystemUnderTest) NodesCount() int {
771+
return s.nodesCount
772+
}
773+
769774
type Node struct {
770775
ID string
771776
IP string

tests/systemtests/testnet_init.go

+14
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ func NewSingleHostTestnetCmdInitializer(
5151
}
5252
}
5353

54+
// InitializerWithBinary creates new SingleHostTestnetCmdInitializer from sut with given binary
55+
func InitializerWithBinary(binary string, sut *SystemUnderTest) TestnetInitializer {
56+
return NewSingleHostTestnetCmdInitializer(
57+
binary,
58+
WorkDir,
59+
sut.chainID,
60+
sut.outputDir,
61+
sut.initialNodesCount,
62+
sut.minGasPrice,
63+
sut.CommitTimeout(),
64+
sut.Log,
65+
)
66+
}
67+
5468
func (s SingleHostTestnetCmdInitializer) Initialize() {
5569
args := []string{
5670
"testnet",

tests/systemtests/upgrade_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ func TestChainUpgrade(t *testing.T) {
2828
currentBranchBinary := sut.execBinary
2929
currentInitializer := sut.testnetInitializer
3030
sut.SetExecBinary(legacyBinary)
31-
sut.SetTestnetInitializer(NewModifyConfigYamlInitializer(legacyBinary, sut))
31+
sut.SetTestnetInitializer(InitializerWithBinary(legacyBinary, sut))
3232
sut.SetupChain()
3333
votingPeriod := 5 * time.Second // enough time to vote
3434
sut.ModifyGenesisJSON(t, SetGovVotingPeriod(t, votingPeriod))
3535

3636
const (
3737
upgradeHeight int64 = 22
38-
upgradeName = "v050-to-v051"
38+
upgradeName = "v050-to-v052" // must match UpgradeName in simapp/upgrades.go
3939
)
4040

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

0 commit comments

Comments
 (0)