Skip to content

Commit

Permalink
provider: fix tests after migrating interface types
Browse files Browse the repository at this point in the history
  • Loading branch information
MSalopek committed Sep 27, 2023
1 parent 4b72097 commit b84d32c
Show file tree
Hide file tree
Showing 9 changed files with 185 additions and 173 deletions.
5 changes: 2 additions & 3 deletions testutil/integration/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ type TestStakingKeeper interface {
GetRedelegations(ctx sdk.Context, delegator sdk.AccAddress,
maxRetrieve uint16) (redelegations []types.Redelegation)
// NOTE: @MSalopek this is a bit confusing to me
// BondDenom(ctx sdk.Context) (res string)
// IsValidatorJailed(ctx sdk.Context, addr sdk.ConsAddress) bool
IsValidatorJailed(ctx context.Context, addr sdk.ConsAddress) bool
BondDenom(ctx context.Context) (string, error)
IsValidatorJailed(ctx context.Context, addr sdk.ConsAddress) (bool, error)
GetUnbondingDelegation(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress,
) (ubd types.UnbondingDelegation, found bool)
GetAllValidators(ctx sdk.Context) (validators []types.Validator)
Expand Down
10 changes: 5 additions & 5 deletions testutil/keeper/expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func GetMocksForMakeConsumerGenesis(ctx sdk.Context, mocks *MockedKeepers,
unbondingTimeToInject time.Duration,
) []*gomock.Call {
return []*gomock.Call{
mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Return(unbondingTimeToInject).Times(1),
mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Return(unbondingTimeToInject, nil).Times(1),

mocks.MockClientKeeper.EXPECT().GetSelfConsensusState(gomock.Any(),
clienttypes.GetSelfHeight(ctx)).Return(&ibctmtypes.ConsensusState{}, nil).Times(1),
Expand Down Expand Up @@ -102,7 +102,7 @@ func GetMocksForHandleSlashPacket(ctx sdk.Context, mocks MockedKeepers,
calls := []*gomock.Call{
mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(
ctx, expectedProviderValConsAddr.ToSdkConsAddr()).Return(
valToReturn, true,
valToReturn, nil,
).Times(1),

mocks.MockSlashingKeeper.EXPECT().IsTombstoned(ctx,
Expand All @@ -113,12 +113,12 @@ func GetMocksForHandleSlashPacket(ctx sdk.Context, mocks MockedKeepers,
calls = append(calls, mocks.MockStakingKeeper.EXPECT().Jail(
gomock.Eq(ctx),
gomock.Eq(expectedProviderValConsAddr.ToSdkConsAddr()),
).Return())
).Return(nil))

// JailUntil is set in this code path.
calls = append(calls, mocks.MockSlashingKeeper.EXPECT().DowntimeJailDuration(ctx).Return(time.Hour).Times(1))
calls = append(calls, mocks.MockSlashingKeeper.EXPECT().DowntimeJailDuration(ctx).Return(time.Hour, nil).Times(1))
calls = append(calls, mocks.MockSlashingKeeper.EXPECT().JailUntil(ctx,
expectedProviderValConsAddr.ToSdkConsAddr(), gomock.Any()).Times(1))
expectedProviderValConsAddr.ToSdkConsAddr(), gomock.Any()).Return(nil).Times(1))
}

return calls
Expand Down
Loading

0 comments on commit b84d32c

Please sign in to comment.