diff --git a/app/upgrades/v5.0.0/upgrades_test.go b/app/upgrades/v5.0.0/upgrades_test.go new file mode 100644 index 000000000..05cb9eb7a --- /dev/null +++ b/app/upgrades/v5.0.0/upgrades_test.go @@ -0,0 +1,65 @@ +package v500_test + +import ( + "testing" + + "cosmossdk.io/math" + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/stretchr/testify/suite" + + v500 "github.com/neutron-org/neutron/v5/app/upgrades/v5.0.0" + "github.com/neutron-org/neutron/v5/testutil/common/sample" + + "github.com/neutron-org/neutron/v5/testutil" + dexkeeper "github.com/neutron-org/neutron/v5/x/dex/keeper" + dextypes "github.com/neutron-org/neutron/v5/x/dex/types" +) + +type UpgradeTestSuite struct { + testutil.IBCConnectionTestSuite +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(UpgradeTestSuite)) +} + +func (suite *UpgradeTestSuite) SetupTest() { + suite.IBCConnectionTestSuite.SetupTest() +} + +func (suite *UpgradeTestSuite) TestUpgradeDexPause() { + var ( + app = suite.GetNeutronZoneApp(suite.ChainA) + ctx = suite.ChainA.GetContext().WithChainID("neutron-1") + msgServer = dexkeeper.NewMsgServerImpl(app.DexKeeper) + ) + + params := app.DexKeeper.GetParams(ctx) + + suite.False(params.Paused) + + upgrade := upgradetypes.Plan{ + Name: v500.UpgradeName, + Info: "some text here", + Height: 100, + } + suite.NoError(app.UpgradeKeeper.ApplyUpgrade(ctx, upgrade)) + + params = app.DexKeeper.GetParams(ctx) + + suite.True(params.Paused) + + _, err := msgServer.Deposit(ctx, &dextypes.MsgDeposit{ + Creator: sample.AccAddress(), + Receiver: sample.AccAddress(), + TokenA: "TokenA", + TokenB: "TokenB", + TickIndexesAToB: []int64{1}, + Fees: []uint64{1}, + AmountsA: []math.Int{math.OneInt()}, + AmountsB: []math.Int{math.ZeroInt()}, + Options: []*dextypes.DepositOptions{{}}, + }) + + suite.ErrorIs(err, dextypes.ErrDexPaused) +}