Skip to content

Commit

Permalink
fix(integration): avoid fail IBC integration tests (#4086)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Pantani and julienrbrt authored Apr 18, 2024
1 parent 014b5ef commit 9179104
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

- [#3969](https://github.com/ignite/cli/pull/3969) Get first config validator using a getter to avoid index errors
- [#4000](https://github.com/ignite/cli/pull/4000) Run all dry runners before the wet run in the `xgenny` pkg
- [#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 @@ -446,7 +446,7 @@ func TestBlogIBC(t *testing.T) {
"install",
"-g",
// filepath.Join(goenv.GoPath(), "src/github.com/ignite/apps/hermes"), // Local path for test proposals
"github.com/ignite/apps/hermes",
"github.com/ignite/apps/hermes@hermes/v0.2.1",
),
)),
))
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 9179104

Please sign in to comment.