Skip to content

Commit bc5f39a

Browse files
committed
tests
1 parent 560c703 commit bc5f39a

File tree

4 files changed

+92
-0
lines changed

4 files changed

+92
-0
lines changed

app/app.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
v700 "github.com/neutron-org/neutron/v8/app/upgrades/v7.0.0"
1414
v800 "github.com/neutron-org/neutron/v8/app/upgrades/v8.0.0"
1515
v800_rc0 "github.com/neutron-org/neutron/v8/app/upgrades/v8.0.0-rc0"
16+
v810 "github.com/neutron-org/neutron/v8/app/upgrades/v8.1.0"
1617
dynamicfeestypes "github.com/neutron-org/neutron/v8/x/dynamicfees/types"
1718
stateverifier "github.com/neutron-org/neutron/v8/x/state-verifier"
1819
svkeeper "github.com/neutron-org/neutron/v8/x/state-verifier/keeper"
@@ -239,6 +240,7 @@ var (
239240
v700.Upgrade,
240241
v800_rc0.Upgrade,
241242
v800.Upgrade,
243+
v810.Upgrade,
242244
}
243245

244246
// DefaultNodeHome default home directories for the application daemon

app/upgrades/v8.1.0/constants.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package v810
2+
3+
import (
4+
storetypes "cosmossdk.io/store/types"
5+
6+
"github.com/neutron-org/neutron/v8/app/upgrades"
7+
)
8+
9+
const (
10+
// UpgradeName defines the on-chain upgrade name.
11+
UpgradeName = "v8.1.0"
12+
)
13+
14+
var Upgrade = upgrades.Upgrade{
15+
UpgradeName: UpgradeName,
16+
CreateUpgradeHandler: CreateUpgradeHandler,
17+
StoreUpgrades: storetypes.StoreUpgrades{},
18+
}

app/upgrades/v8.1.0/upgrades.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package v810
2+
3+
import (
4+
"context"
5+
"fmt"
6+
7+
upgradetypes "cosmossdk.io/x/upgrade/types"
8+
"github.com/cosmos/cosmos-sdk/codec"
9+
sdk "github.com/cosmos/cosmos-sdk/types"
10+
"github.com/cosmos/cosmos-sdk/types/module"
11+
12+
"github.com/neutron-org/neutron/v8/app/upgrades"
13+
)
14+
15+
func CreateUpgradeHandler(
16+
mm *module.Manager,
17+
configurator module.Configurator,
18+
keepers *upgrades.UpgradeKeepers,
19+
_ upgrades.StoreKeys,
20+
cdc codec.Codec,
21+
) upgradetypes.UpgradeHandler {
22+
return func(c context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
23+
ctx := sdk.UnwrapSDKContext(c)
24+
25+
ctx.Logger().Info("Starting module migrations...")
26+
27+
vm, err := mm.RunMigrations(ctx, configurator, vm)
28+
if err != nil {
29+
return vm, err
30+
}
31+
32+
ctx.Logger().Info(fmt.Sprintf("Migration {%s} applied", UpgradeName))
33+
return vm, nil
34+
}
35+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package v810_test
2+
3+
import (
4+
"testing"
5+
6+
upgradetypes "cosmossdk.io/x/upgrade/types"
7+
"github.com/stretchr/testify/require"
8+
"github.com/stretchr/testify/suite"
9+
10+
v810 "github.com/neutron-org/neutron/v8/app/upgrades/v8.1.0"
11+
"github.com/neutron-org/neutron/v8/testutil"
12+
)
13+
14+
type UpgradeTestSuite struct {
15+
testutil.IBCConnectionTestSuite
16+
}
17+
18+
func TestKeeperTestSuite(t *testing.T) {
19+
suite.Run(t, new(UpgradeTestSuite))
20+
}
21+
22+
func (suite *UpgradeTestSuite) SetupTest() {
23+
suite.IBCConnectionTestSuite.SetupTest()
24+
}
25+
26+
func (suite *UpgradeTestSuite) TestUpgrade() {
27+
app := suite.GetNeutronZoneApp(suite.ChainA)
28+
ctx := suite.ChainA.GetContext().WithChainID("neutron-1")
29+
t := suite.T()
30+
31+
upgrade := upgradetypes.Plan{
32+
Name: v810.UpgradeName,
33+
Info: "some text here",
34+
Height: 100,
35+
}
36+
require.NoError(t, app.UpgradeKeeper.ApplyUpgrade(ctx, upgrade))
37+
}

0 commit comments

Comments
 (0)