-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: use mocks for x/slashing #12937
Conversation
Codecov Report
@@ Coverage Diff @@
## main #12937 +/- ##
==========================================
- Coverage 55.87% 55.49% -0.39%
==========================================
Files 646 646
Lines 54895 54865 -30
==========================================
- Hits 30675 30448 -227
- Misses 21762 21964 +202
+ Partials 2458 2453 -5
|
…dk into john/12748-mock-slashing
tstaking.CheckValidator(valAddr, stakingtypes.Unbonding, true) | ||
expectedPubKey, err := keeper.GetPubkey(ctx, addr.Bytes()) | ||
require.NoError(err) | ||
require.Equal(pubKey, expectedPubKey) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gutting of this file seems OK since it was moved as an integration test to integration/slashing/keeper
. Is that what you're thinking too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing which I am struggling is test coverage, moving the original ones to integration
leads to a massive dropdown of test coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
s.slashingKeeper.HandleValidatorSignature(ctx, val.Address(), newPower, true) | ||
|
||
// validator should not be kicked since we reset counter/array when it was jailed | ||
staking.EndBlocker(ctx, s.stakingKeeper) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey quick question @cool-develope : did you also convert this test to use mocks? In particular how did you deal with this EndBlocker function, that takes a real keeper and not an interface.
(having the same issue in x/gov)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, I couldn't mock that one, this is why I moved keeper_test.go
to integration/slashing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AmauryM tests/integration/slashing/keeper/keeper_test.go
Description
Closes: #12748
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change