mukan-ibc/modules/apps/27-interchain-accounts/host/keeper/migrations_test.go
Mukan Erkin Törük 6852832fe8
Some checks failed
CodeQL / Analyze (push) Waiting to run
Docker Build & Push Simapp (main) / docker-build (push) Waiting to run
golangci-lint / lint (push) Waiting to run
Tests / Code Coverage / build (amd64) (push) Waiting to run
Tests / Code Coverage / build (arm64) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[additional-args:-tags="test_e2e" name:e2e path:./e2e]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:08-wasm path:./modules/light-clients/08-wasm]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:ibc-go path:.]) (push) Waiting to run
Deploy to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled
Buf-Push / push (push) Has been cancelled
initial: sovereign Mukan Network fork
2026-05-11 03:18:28 +03:00

62 lines
2 KiB
Go

package keeper_test
import (
"fmt"
"github.com/cosmos/cosmos-sdk/runtime"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
icahostkeeper "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host/types"
)
func (suite *KeeperTestSuite) TestMigratorMigrateParams() {
testCases := []struct {
msg string
malleate func()
expectedParams icahosttypes.Params
}{
{
"success: default params",
func() {
params := icahosttypes.DefaultParams()
subspace := suite.chainA.GetSimApp().GetSubspace(icahosttypes.SubModuleName) // get subspace
subspace.SetParamSet(suite.chainA.GetContext(), &params) // set params
},
icahosttypes.DefaultParams(),
},
{
"success: no legacy params pre-migration",
func() {
suite.chainA.GetSimApp().ICAHostKeeper = icahostkeeper.NewKeeper(
suite.chainA.Codec,
runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(icahosttypes.StoreKey)),
nil, // assign a nil legacy param subspace
suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper,
suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper,
suite.chainA.GetSimApp().AccountKeeper,
suite.chainA.GetSimApp().MsgServiceRouter(),
suite.chainA.GetSimApp().GRPCQueryRouter(),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
},
icahosttypes.DefaultParams(),
},
}
for _, tc := range testCases {
suite.Run(fmt.Sprintf("case %s", tc.msg), func() {
suite.SetupTest() // reset
tc.malleate() // explicitly set params
migrator := icahostkeeper.NewMigrator(&suite.chainA.GetSimApp().ICAHostKeeper)
err := migrator.MigrateParams(suite.chainA.GetContext())
suite.Require().NoError(err)
params := suite.chainA.GetSimApp().ICAHostKeeper.GetParams(suite.chainA.GetContext())
suite.Require().Equal(tc.expectedParams, params)
})
}
}