Skip to content

Commit

Permalink
Register required types for upgrade E2E tests (#3132)
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton authored Feb 14, 2023
1 parent 55300ab commit 59ef5bc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/e2e-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
- test: TestV6ToV7ChainUpgrade
chain-image: ghcr.io/cosmos/ibc-go-simd
chain-binary: simd
chain-a-tag: v6.0.0
chain-b-tag: v6.0.0
chain-upgrade-tag: v7.0.0
chain-a-tag: v6.1.0
chain-b-tag: v6.1.0
chain-upgrade-tag: v7.0.0-rc0
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/upgrades/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func (s *UpgradeTestSuite) TestV5ToV6ChainUpgrade() {

t.Run("interchain account executes a bank transfer on behalf of the corresponding owner account", func(t *testing.T) {
t.Run("fund interchain account wallet", func(t *testing.T) {
// fund the host account account so it has some $$ to send
// fund the host account, so it has some $$ to send
err := chainB.SendFunds(ctx, interchaintest.FaucetAccountKeyName, ibc.WalletAmount{
Address: hostAccount,
Amount: testvalues.StartingTokenAmount,
Expand Down
26 changes: 22 additions & 4 deletions e2e/testsuite/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ import (
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
grouptypes "github.com/cosmos/cosmos-sdk/x/group"
proposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"

icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
feetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"
transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
v7migrations "github.com/cosmos/ibc-go/v7/modules/core/02-client/migrations/v7"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine"
ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
simappparams "github.com/cosmos/ibc-go/v7/testing/simapp/params"
)

Expand All @@ -30,18 +37,29 @@ func EncodingConfig() simappparams.EncodingConfig {

func codecAndEncodingConfig() (*codec.ProtoCodec, simappparams.EncodingConfig) {
cfg := simappparams.MakeTestEncodingConfig()

// ibc types
icacontrollertypes.RegisterInterfaces(cfg.InterfaceRegistry)
feetypes.RegisterInterfaces(cfg.InterfaceRegistry)
intertxtypes.RegisterInterfaces(cfg.InterfaceRegistry)
solomachine.RegisterInterfaces(cfg.InterfaceRegistry)
v7migrations.RegisterInterfaces(cfg.InterfaceRegistry)
transfertypes.RegisterInterfaces(cfg.InterfaceRegistry)
clienttypes.RegisterInterfaces(cfg.InterfaceRegistry)
channeltypes.RegisterInterfaces(cfg.InterfaceRegistry)
connectiontypes.RegisterInterfaces(cfg.InterfaceRegistry)
ibctmtypes.RegisterInterfaces(cfg.InterfaceRegistry)

// all other types
upgradetypes.RegisterInterfaces(cfg.InterfaceRegistry)
banktypes.RegisterInterfaces(cfg.InterfaceRegistry)
govv1beta1.RegisterInterfaces(cfg.InterfaceRegistry)
govv1.RegisterInterfaces(cfg.InterfaceRegistry)
authtypes.RegisterInterfaces(cfg.InterfaceRegistry)
feetypes.RegisterInterfaces(cfg.InterfaceRegistry)
icacontrollertypes.RegisterInterfaces(cfg.InterfaceRegistry)
sdkcodec.RegisterInterfaces(cfg.InterfaceRegistry)
grouptypes.RegisterInterfaces(cfg.InterfaceRegistry)
proposaltypes.RegisterInterfaces(cfg.InterfaceRegistry)
authz.RegisterInterfaces(cfg.InterfaceRegistry)
transfertypes.RegisterInterfaces(cfg.InterfaceRegistry)
clienttypes.RegisterInterfaces(cfg.InterfaceRegistry)

cdc := codec.NewProtoCodec(cfg.InterfaceRegistry)
return cdc, cfg
Expand Down
18 changes: 6 additions & 12 deletions e2e/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ const (
ChainBRelayerName = "rlyB"
// DefaultGasValue is the default gas value used to configure tx.Factory
DefaultGasValue = 500000
// emptyLogs is the string value returned from `BroadcastMessages`. There are some situations in which
// the result is empty, when this happens we include the raw logs instead to get as much information
// amount the failure as possible.
emptyLogs = "[]"
)

// E2ETestSuite has methods and functionality which can be shared among all test suites.
Expand Down Expand Up @@ -404,14 +400,12 @@ func (s *E2ETestSuite) InitGRPCClients(chain *cosmos.CosmosChain) {
// AssertValidTxResponse verifies that an sdk.TxResponse
// has non-empty values.
func (s *E2ETestSuite) AssertValidTxResponse(resp sdk.TxResponse) {
respLogsMsg := resp.Logs.String()
if respLogsMsg == emptyLogs {
respLogsMsg = resp.RawLog
}
s.Require().NotEqual(int64(0), resp.GasUsed, respLogsMsg)
s.Require().NotEqual(int64(0), resp.GasWanted, respLogsMsg)
s.Require().NotEmpty(resp.Events, respLogsMsg)
s.Require().NotEmpty(resp.Data, respLogsMsg)
errorMsg := fmt.Sprintf("%+v", resp)
s.Require().NotEmpty(resp.TxHash, errorMsg)
s.Require().NotEqual(int64(0), resp.GasUsed, errorMsg)
s.Require().NotEqual(int64(0), resp.GasWanted, errorMsg)
s.Require().NotEmpty(resp.Events, errorMsg)
s.Require().NotEmpty(resp.Data, errorMsg)
}

// AssertPacketRelayed asserts that the packet commitment does not exist on the sending chain.
Expand Down

0 comments on commit 59ef5bc

Please sign in to comment.