-
Notifications
You must be signed in to change notification settings - Fork 46
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(tests): improve x/reports tests using gomock #1184
Conversation
42902b9
to
0660513
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1184 +/- ##
=======================================
Coverage 80.79% 80.80%
=======================================
Files 194 194
Lines 17310 17310
=======================================
+ Hits 13986 13987 +1
Misses 2727 2727
+ Partials 597 596 -1
☔ View full report in Codecov by Sentry. |
f102338
to
a89646c
Compare
|
||
// Delete the reason id key | ||
h.k.DeleteNextReasonID(ctx, subspaceID) | ||
|
||
// Delete all the reasons related to this subspace | ||
h.k.IterateSubspaceReasons(ctx, subspaceID, func(reason types.Reason) (stop bool) { | ||
h.k.DeleteReason(ctx, reason.SubspaceID, reason.ID) | ||
return false | ||
}) |
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.
Why was this code moved here instead of keeping it above?
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.
DeleteReason
also deletes reports containing reasons here, but it causes O(N) since it iterates all the reports when removing a reason, as a result, it makes AfterSubspaceDeleted
has O(N^2) time complexity.
Moving this code above can have better performance with O(2N) time complexity since reports containing reasons are removed first.
Description
This PR improves the x/reports tests using gomock.
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