From a28e4a0d3bab27de8644715040503c2794dda1e8 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 26 Apr 2024 11:14:38 +0000 Subject: [PATCH] fix(integration): avoid fail IBC integration tests (backport #4086) (#4109) * fix(integration): avoid fail IBC integration tests (#4086) * retry get ibc balance if fails first time for the ibc integration tests * add changelog * split ibc relayer and ibc tests * specify hermes version * improve ci logs for relayer integration tests * reset balance output --------- Co-authored-by: Pantani Co-authored-by: Julien Robert (cherry picked from commit 917910432a8bcb50be4ca786479fba02d4b9b0af) * Update changelog.md --------- Co-authored-by: Danilo Pantani Co-authored-by: Julien Robert --- changelog.md | 1 + integration/{ibc => relayer}/cmd_relayer_test.go | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) rename integration/{ibc => relayer}/cmd_relayer_test.go (97%) diff --git a/changelog.md b/changelog.md index e0108a0479..9449fa8c62 100644 --- a/changelog.md +++ b/changelog.md @@ -16,6 +16,7 @@ - [#4033](https://github.com/ignite/cli/pull/4033) Fix cobra completion using `fishshell` - [#4062](https://github.com/ignite/cli/pull/4062) Avoid nil `scopedKeeper` in `TransmitXXX` functions - [#3969](https://github.com/ignite/cli/pull/3969) Get first config validator using a getter to avoid index errors +- [#4086](https://github.com/ignite/cli/pull/4086) Retry to get the IBC balance if it fails the first time ## [`v28.3.0`](https://github.com/ignite/cli/releases/tag/v28.3.0) diff --git a/integration/ibc/cmd_relayer_test.go b/integration/relayer/cmd_relayer_test.go similarity index 97% rename from integration/ibc/cmd_relayer_test.go rename to integration/relayer/cmd_relayer_test.go index 206245478c..a3b15f813e 100644 --- a/integration/ibc/cmd_relayer_test.go +++ b/integration/relayer/cmd_relayer_test.go @@ -1,6 +1,6 @@ //go:build !relayer -package ibc_test +package relayer_test import ( "bytes" @@ -596,7 +596,7 @@ func TestBlogIBC(t *testing.T) { balanceOutput = &bytes.Buffer{} balanceResponse QueryBalances ) - env.Must(env.Exec("check ibc balance", step.NewSteps( + steps := step.NewSteps( step.New( step.Stdout(balanceOutput), step.Exec( @@ -607,6 +607,7 @@ func TestBlogIBC(t *testing.T) { receiverAddr, "--node", marsRPC, "--home", marsHome, + "--chain-id", marsChainID, "--log_format", "json", "--output", "json", ), @@ -614,8 +615,11 @@ func TestBlogIBC(t *testing.T) { if execErr != nil { return execErr } - if err := json.Unmarshal(balanceOutput.Bytes(), &balanceResponse); err != nil { - return fmt.Errorf("unmarshalling tx response: %w", err) + + output := balanceOutput.Bytes() + defer balanceOutput.Reset() + if err := json.Unmarshal(output, &balanceResponse); err != nil { + return fmt.Errorf("unmarshalling query response error: %w, response: %s", err, string(output)) } if balanceResponse.Balances.Empty() { return fmt.Errorf("empty balances") @@ -623,10 +627,12 @@ func TestBlogIBC(t *testing.T) { if !strings.HasPrefix(balanceResponse.Balances[0].Denom, "ibc/") { return fmt.Errorf("invalid ibc balance: %v", balanceResponse.Balances[0]) } + return nil }), ), - ))) + ) + env.Must(env.Exec("check ibc balance", steps, envtest.ExecRetry())) // TODO test ibc using the blog post methods: // step.Exec(app.Binary(), "tx", "blog", "send-ibc-post", "transfer", "channel-0", "Hello", "Hello_Mars-Alice_from_Earth", "--chain-id", earthChainID, "--from", "alice", "--node", earthGRPC, "--output", "json", "--log_format", "json", "--yes")