Skip to content

Commit

Permalink
fix(integration): avoid fail IBC integration tests (backport #4086) (#…
Browse files Browse the repository at this point in the history
…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 <Pantani>
Co-authored-by: Julien Robert <julien@rbrt.fr>
(cherry picked from commit 9179104)

* Update changelog.md

---------

Co-authored-by: Danilo Pantani <danpantani@gmail.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
  • Loading branch information
3 people committed May 3, 2024
1 parent 93dddeb commit a28e4a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build !relayer

package ibc_test
package relayer_test

import (
"bytes"
Expand Down Expand Up @@ -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(
Expand All @@ -607,26 +607,32 @@ func TestBlogIBC(t *testing.T) {
receiverAddr,
"--node", marsRPC,
"--home", marsHome,
"--chain-id", marsChainID,
"--log_format", "json",
"--output", "json",
),
step.PostExec(func(execErr error) error {
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")
}
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")
Expand Down

0 comments on commit a28e4a0

Please sign in to comment.