Skip to content

Commit

Permalink
fix: pool query checks
Browse files Browse the repository at this point in the history
  • Loading branch information
shifty11 committed Oct 5, 2023
1 parent 79f1cad commit 98004d8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
15 changes: 10 additions & 5 deletions testutil/integration/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ func (suite *KeeperTestSuite) PerformValidityChecks() {
// verify pool module
suite.VerifyPoolModuleAssetsIntegrity()
suite.VerifyPoolTotalFunds()

if suite.options.VerifyPoolQueries {
suite.VerifyPoolQueries()
}

suite.VerifyPoolQueries()
suite.VerifyPoolGenesisImportExport()

// verify stakers module
Expand Down Expand Up @@ -99,6 +95,15 @@ func (suite *KeeperTestSuite) VerifyPoolQueries() {
poolsQuery = append(poolsQuery, activePoolsQuery.Pools...)
poolsQuery = append(poolsQuery, disabledPoolsQuery.Pools...)

// sort pools by id
for i := range poolsQuery {
for j := range poolsQuery {
if poolsQuery[i].Id < poolsQuery[j].Id {
poolsQuery[i], poolsQuery[j] = poolsQuery[j], poolsQuery[i]
}
}
}

Expect(activePoolsQueryErr).To(BeNil())
Expect(disabledPoolsQueryErr).To(BeNil())

Expand Down
12 changes: 0 additions & 12 deletions testutil/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ type QueryClients struct {
stakersClient stakerstypes.QueryClient
}

type KeeperTestSuiteOptions struct {
VerifyPoolQueries bool
}

type KeeperTestSuite struct {
suite.Suite

Expand All @@ -148,7 +144,6 @@ type KeeperTestSuite struct {
consAddress sdk.ConsAddress
validator stakingtypes.Validator
denom string
options KeeperTestSuiteOptions
}

func (suite *KeeperTestSuite) App() *app.App {
Expand Down Expand Up @@ -224,13 +219,6 @@ func (suite *KeeperTestSuite) SetupApp(startTime int64) {
_ = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator)
validators := suite.app.StakingKeeper.GetValidators(suite.ctx, 1)
suite.validator = validators[0]
suite.options = KeeperTestSuiteOptions{
VerifyPoolQueries: true,
}
}

func (suite *KeeperTestSuite) SetOptions(options KeeperTestSuiteOptions) {
suite.options = options
}

func (suite *KeeperTestSuite) Commit() {
Expand Down
2 changes: 2 additions & 0 deletions x/delegation/keeper/msg_server_delegate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ TEST CASES - msg_server_delegate.go
* Don't pay out rewards twice
* Delegate to validator with 0 $KYVE
* Delegate to multiple validators
*/

var _ = Describe("msg_server_delegate.go", Ordered, func() {
Expand Down Expand Up @@ -267,6 +268,7 @@ var _ = Describe("msg_server_delegate.go", Ordered, func() {
Expect(charlieDelegation).To(Equal(200 * i.KYVE))
})

// TODO: delegate to multiple validators
It("Delegate to multiple validators", func() {
// ARRANGE
s.RunTxStakersSuccess(&stakerstypes.MsgCreateStaker{
Expand Down
1 change: 0 additions & 1 deletion x/pool/keeper/msg_server_disable_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ var _ = Describe("msg_server_disable_pool.go", Ordered, func() {

BeforeEach(func() {
s = i.NewCleanChain()
s.SetOptions(i.KeeperTestSuiteOptions{VerifyPoolQueries: false})

// create clean pool for every test case
s.App().PoolKeeper.AppendPool(s.Ctx(), types.Pool{
Expand Down

0 comments on commit 98004d8

Please sign in to comment.