Some checks failed
CodeQL / Analyze (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
Docker Build & Push Simapp (main) / docker-build (push) Has been cancelled
58 lines
1.9 KiB
Go
58 lines
1.9 KiB
Go
package keeper_test
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.cw.tr/mukan-network/mukan-sdk/runtime"
|
|
|
|
icacontrollerkeeper "git.cw.tr/mukan-network/mukan-ibc/modules/apps/27-interchain-accounts/controller/keeper"
|
|
icacontrollertypes "git.cw.tr/mukan-network/mukan-ibc/modules/apps/27-interchain-accounts/controller/types"
|
|
)
|
|
|
|
func (suite *KeeperTestSuite) TestMigratorMigrateParams() {
|
|
testCases := []struct {
|
|
msg string
|
|
malleate func()
|
|
expectedParams icacontrollertypes.Params
|
|
}{
|
|
{
|
|
"success: default params",
|
|
func() {
|
|
params := icacontrollertypes.DefaultParams()
|
|
subspace := suite.chainA.GetSimApp().GetSubspace(icacontrollertypes.SubModuleName) // get subspace
|
|
subspace.SetParamSet(suite.chainA.GetContext(), ¶ms) // set params
|
|
},
|
|
icacontrollertypes.DefaultParams(),
|
|
},
|
|
{
|
|
"success: no legacy params pre-migration",
|
|
func() {
|
|
suite.chainA.GetSimApp().ICAControllerKeeper = icacontrollerkeeper.NewKeeper(
|
|
suite.chainA.Codec,
|
|
runtime.NewKVStoreService(suite.chainA.GetSimApp().GetKey(icacontrollertypes.StoreKey)),
|
|
nil, // assign a nil legacy param subspace
|
|
suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper,
|
|
suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper,
|
|
suite.chainA.GetSimApp().MsgServiceRouter(),
|
|
suite.chainA.GetSimApp().ICAControllerKeeper.GetAuthority(),
|
|
)
|
|
},
|
|
icacontrollertypes.DefaultParams(),
|
|
},
|
|
}
|
|
|
|
for _, tc := range testCases {
|
|
suite.Run(fmt.Sprintf("case %s", tc.msg), func() {
|
|
suite.SetupTest() // reset
|
|
|
|
tc.malleate() // explicitly set params
|
|
|
|
migrator := icacontrollerkeeper.NewMigrator(&suite.chainA.GetSimApp().ICAControllerKeeper)
|
|
err := migrator.MigrateParams(suite.chainA.GetContext())
|
|
suite.Require().NoError(err)
|
|
|
|
params := suite.chainA.GetSimApp().ICAControllerKeeper.GetParams(suite.chainA.GetContext())
|
|
suite.Require().Equal(tc.expectedParams, params)
|
|
})
|
|
}
|
|
}
|