Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(integration): avoid fail IBC integration tests #4086

Merged
merged 7 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading