Skip to content

Commit

Permalink
Handle error on interchaintest.
Browse files Browse the repository at this point in the history
  • Loading branch information
tnv1 committed Jan 24, 2024
1 parent fb6075a commit 9c5dadc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
16 changes: 12 additions & 4 deletions tests/interchaintest/host_zone_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package interchaintest
import (
"context"
"fmt"
feeabsCli "github.com/notional-labs/fee-abstraction/tests/interchaintest/feeabs"
"testing"

feeabsCli "github.com/notional-labs/fee-abstraction/tests/interchaintest/feeabs"

"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
"github.com/stretchr/testify/require"
)
Expand All @@ -28,7 +29,9 @@ func TestHostZoneProposal(t *testing.T) {
err = feeabs.VoteOnProposalAllValidators(ctx, "1", cosmos.ProposalVoteYes)
require.NoError(t, err, "failed to submit votes")

height, _ := feeabs.Height(ctx)
height, err := feeabs.Height(ctx)
require.NoError(t, err)

_, err = cosmos.PollForProposalStatus(ctx, feeabs, height, height+10, "1", cosmos.ProposalStatusPassed)
require.NoError(t, err, "proposal status did not change to passed in expected number of blocks")

Expand All @@ -48,7 +51,9 @@ func TestHostZoneProposal(t *testing.T) {
err = feeabs.VoteOnProposalAllValidators(ctx, "2", cosmos.ProposalVoteYes)
require.NoError(t, err, "failed to submit votes")

height, _ = feeabs.Height(ctx)
height, err = feeabs.Height(ctx)
require.NoError(t, err)

_, err = cosmos.PollForProposalStatus(ctx, feeabs, height, height+10, "2", cosmos.ProposalStatusPassed)
require.NoError(t, err, "proposal status did not change to passed in expected number of blocks")

Expand All @@ -68,12 +73,15 @@ func TestHostZoneProposal(t *testing.T) {
err = feeabs.VoteOnProposalAllValidators(ctx, "3", cosmos.ProposalVoteYes)
require.NoError(t, err, "failed to submit votes")

height, _ = feeabs.Height(ctx)
height, err = feeabs.Height(ctx)
require.NoError(t, err)

response, err := cosmos.PollForProposalStatus(ctx, feeabs, height, height+10, "3", cosmos.ProposalStatusPassed)
require.NoError(t, err, "proposal status did not change to passed in expected number of blocks")
fmt.Printf("response: %s\n", response)

config, err = feeabsCli.QueryHostZoneConfigWithDenom(feeabs, ctx, "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9")
require.NoError(t, err)
require.Equal(t, config, &feeabsCli.HostChainFeeAbsConfigResponse{HostChainConfig: feeabsCli.HostChainFeeAbsConfig{
IbcDenom: "",
OsmosisPoolTokenDenomIn: "",
Expand Down
18 changes: 12 additions & 6 deletions tests/interchaintest/packet_foward_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ package interchaintest

import (
"context"
"cosmossdk.io/math"
"fmt"
sdktypes "github.com/cosmos/cosmos-sdk/types"
paramsutils "github.com/cosmos/cosmos-sdk/x/params/client/utils"
feeabsCli "github.com/notional-labs/fee-abstraction/tests/interchaintest/feeabs"
"os"
"path"
"testing"

"cosmossdk.io/math"
sdktypes "github.com/cosmos/cosmos-sdk/types"
paramsutils "github.com/cosmos/cosmos-sdk/x/params/client/utils"
feeabsCli "github.com/notional-labs/fee-abstraction/tests/interchaintest/feeabs"

transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
Expand Down Expand Up @@ -143,6 +144,7 @@ func TestPacketForwardMiddleware(t *testing.T) {
// send ibc token to feeabs module account
gaiaHeight, err := gaia.Height(ctx)
require.NoError(t, err)

feeabsModule, err := feeabsCli.QueryModuleAccountBalances(feeabs, ctx)
require.NoError(t, err)
dstAddress := feeabsModule.Address
Expand Down Expand Up @@ -176,7 +178,9 @@ func TestPacketForwardMiddleware(t *testing.T) {
err = feeabs.VoteOnProposalAllValidators(ctx, paramTx.ProposalID, cosmos.ProposalVoteYes)
require.NoError(t, err, "failed to submit votes")

height, _ := feeabs.Height(ctx)
height, err := feeabs.Height(ctx)
require.NoError(t, err)

_, err = cosmos.PollForProposalStatus(ctx, feeabs, height, height+10, paramTx.ProposalID, cosmos.ProposalStatusPassed)
require.NoError(t, err, "proposal status did not change to passed in expected number of blocks")

Expand All @@ -186,7 +190,9 @@ func TestPacketForwardMiddleware(t *testing.T) {
err = feeabs.VoteOnProposalAllValidators(ctx, "2", cosmos.ProposalVoteYes)
require.NoError(t, err, "failed to submit votes")

height, _ = feeabs.Height(ctx)
height, err = feeabs.Height(ctx)
require.NoError(t, err)

_, err = cosmos.PollForProposalStatus(ctx, feeabs, height, height+10, "2", cosmos.ProposalStatusPassed)
require.NoError(t, err, "proposal status did not change to passed in expected number of blocks")

Expand Down

0 comments on commit 9c5dadc

Please sign in to comment.