From 919947dae11fb733dc0e4c7669a974b58b39581c Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Thu, 4 Jul 2024 08:59:52 +0200 Subject: [PATCH] Remove migration test --- .../provider/migrations/vX/migration_test.go | 57 ------------------- 1 file changed, 57 deletions(-) delete mode 100644 x/ccv/provider/migrations/vX/migration_test.go diff --git a/x/ccv/provider/migrations/vX/migration_test.go b/x/ccv/provider/migrations/vX/migration_test.go deleted file mode 100644 index f66c73301f..0000000000 --- a/x/ccv/provider/migrations/vX/migration_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package v6 - -import ( - "testing" - - "github.com/stretchr/testify/require" - - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" -) - -func TestMigrateParams(t *testing.T) { - t.Helper() - inMemParams := testutil.NewInMemKeeperParams(t) - k, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, inMemParams) - defer ctrl.Finish() - - if !inMemParams.ParamsSubspace.HasKeyTable() { - inMemParams.ParamsSubspace.WithKeyTable(providertypes.ParamKeyTable()) - } - - defaultParams := providertypes.DefaultParams() - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTemplateClient, defaultParams.TemplateClient) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTrustingPeriodFraction, defaultParams.TrustingPeriodFraction) - inMemParams.ParamsSubspace.Set(ctx, ccvtypes.KeyCCVTimeoutPeriod, defaultParams.CcvTimeoutPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyInitTimeoutPeriod, defaultParams.InitTimeoutPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyVscTimeoutPeriod, defaultParams.VscTimeoutPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishPeriod, defaultParams.SlashMeterReplenishPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishFraction, defaultParams.SlashMeterReplenishFraction) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyConsumerRewardDenomRegistrationFee, defaultParams.ConsumerRewardDenomRegistrationFee) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyBlocksPerEpoch, defaultParams.BlocksPerEpoch) - - // confirms that inMemParams.ParamsSubspace works as expected - require.NotPanics(t, func() { - GetParamsLegacy(ctx, inMemParams.ParamsSubspace) - }) - - // no "new" params should be available before migration - // "new" params are stored under providertypes.ParametersKey() - emptyParams := k.GetParams(ctx) - require.Empty(t, emptyParams) - - // make sure that the legacy params are equal to the default params (they were set using inMemParams.ParamsSubspace.Set()) - legacyParams := GetParamsLegacy(ctx, inMemParams.ParamsSubspace) - require.NotNil(t, legacyParams) - require.Equal(t, defaultParams, legacyParams) - - err := MigrateLegacyParams(ctx, k, inMemParams.ParamsSubspace) - require.NoError(t, err) - - // check that "new" params are available after migration and equal to defaults - migratedParams := k.GetParams(ctx) - require.NotEmpty(t, migratedParams) - require.Equal(t, defaultParams, migratedParams) - require.NotEqual(t, emptyParams, migratedParams) -}