-
Notifications
You must be signed in to change notification settings - Fork 334
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
Create a dedicated helper for retrying API calls during tests. #1695
Conversation
This is an expansion of the workaround that vaikas initially added to address knative/test-infra#2346, however, a few new error types have emerged, which this will retry.
"k8s.io/client-go/util/retry" | ||
) | ||
|
||
// RetryUpdateConflicts retries the inner function if it returns conflict errors. | ||
// This can be used to retry status updates without constantly reenqueuing keys. | ||
func RetryUpdateConflicts(updater func(int) error) error { | ||
return RetryErrors(updater, apierrs.IsConflict) |
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.
Note that this is effectively the definition of retry.RetryOnConflict
today.
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattmoor, n3wscott The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is an expansion of the workaround that vaikas initially added to address knative/test-infra#2346, however, a few new error types have emerged, which this will retry.