-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(cherry picked from commit 09f3184) # Conflicts: # app/upgrades/v9/constants.go # app/upgrades/v9/upgrades.go
- Loading branch information
1 parent
e0ab1db
commit 61c9309
Showing
5 changed files
with
158 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package v9_test | ||
|
||
import ( | ||
"fmt" | ||
|
||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
abci "github.com/tendermint/tendermint/abci/types" | ||
) | ||
|
||
const dummyUpgradeHeight = 5 | ||
|
||
func (suite *UpgradeTestSuite) TestUpgradePayments() { | ||
testCases := []struct { | ||
msg string | ||
pre_update func() | ||
update func() | ||
post_update func() | ||
expPass bool | ||
}{ | ||
{ | ||
"Test that upgrade does not panic", | ||
func() { | ||
// Create pool 1 | ||
suite.PrepareBalancerPool() | ||
}, | ||
func() { | ||
// run upgrade | ||
// TODO: Refactor this all into a helper fn | ||
suite.Ctx = suite.Ctx.WithBlockHeight(dummyUpgradeHeight - 1) | ||
plan := upgradetypes.Plan{Name: "v9", Height: dummyUpgradeHeight} | ||
err := suite.App.UpgradeKeeper.ScheduleUpgrade(suite.Ctx, plan) | ||
suite.Require().NoError(err) | ||
plan, exists := suite.App.UpgradeKeeper.GetUpgradePlan(suite.Ctx) | ||
suite.Require().True(exists) | ||
|
||
suite.Ctx = suite.Ctx.WithBlockHeight(dummyUpgradeHeight) | ||
suite.Require().NotPanics(func() { | ||
beginBlockRequest := abci.RequestBeginBlock{} | ||
suite.App.BeginBlocker(suite.Ctx, beginBlockRequest) | ||
}) | ||
}, | ||
func() { | ||
|
||
}, | ||
true, | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { | ||
suite.SetupTest() // reset | ||
|
||
tc.pre_update() | ||
tc.update() | ||
tc.post_update() | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters