-
Notifications
You must be signed in to change notification settings - Fork 44
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
test: Retry test doc mutation on transaction conflict #1366
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1366 +/- ##
===========================================
- Coverage 70.59% 70.55% -0.05%
===========================================
Files 184 184
Lines 17835 17835
===========================================
- Hits 12591 12583 -8
- Misses 4288 4295 +7
- Partials 956 957 +1 |
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.
Approving but I have a couple suggestions before you merge :)
tests/integration/utils2.go
Outdated
// about this in our tests so we just retry a few times until it works (or the | ||
// retry limit is breached - important incase this is a different error) | ||
func withRetry( | ||
ctx context.Context, |
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.
suggestion: ctx
isn't used so you can probably remove it from the parameters.
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.
Ops cheers - it was used, and then I switched to the func param. Will remove
- rm ctx
nodes []*node.Node, | ||
nodeID int, |
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.
suggestion: You could use node *node.Node
instead and avoid having to pass 2 params.
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.
I was 50-50 about that one, in my head at least a lot of the test utils code does stuff like that - preferring the refactoring out of the finding of the correct thing instead of saving on param count. Will have a look in a bit and then see what I feel like in the moment unless you have a strong preference.
- maybe just pass in node
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.
Leaving as-is
…1366) * Refactor update-save retry logic * Retry on create doc transaction conflict * Retry on delete doc transaction conflict
Relevant issue(s)
Resolves #1365
Description
Adds Retry mechanics for test doc create and delete on transaction conflict.
The logic existed for update, and has now been expanded to cover Create and Update.
It could probably be extended to cover requests, but I dont think any P2P tests use mutation requests at the moment.