-
Notifications
You must be signed in to change notification settings - Fork 265
NO-JIRA: simplify waiting in GetLastKeyMeta #2219
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -201,29 +201,16 @@ func GetLastKeyMeta(t testing.TB, kubeClient kubernetes.Interface, namespace, la | |
|
|
||
| // in theory the max time we tolerate disruption on an SNO cluster is 60 seconds | ||
| // so we set the timeout to 5 min just in case | ||
| pollTimeout := time.Minute * 5 | ||
|
|
||
| // set the number of step to high value | ||
| // we should stop on timeout otherwise the backoff returns after 5 steps | ||
| // and we never wait the timeout value | ||
| backOff := retry.DefaultBackoff | ||
| backOff.Steps = 9999 | ||
|
|
||
| // in theory the max time we tolerate disruption on an SNO cluster is 60 seconds | ||
| // so we set the timeout to 5 min just in case | ||
| err := onErrorWithTimeout(pollTimeout, backOff, func(err error) bool { | ||
| if !transientAPIError(err) { | ||
| t.Logf("error = %v is not retriable, failed to get the metadata from the last encryption key", err) | ||
| return false | ||
| } | ||
| return true // retry | ||
| }, func() (err error) { | ||
| selectedSecrets, err = secretsClient.List(context.TODO(), metav1.ListOptions{LabelSelector: labelSelector}) | ||
| err := wait.PollUntilContextTimeout(t.Context(), 30*time.Second, time.Minute*5, true, func(ctx context.Context) (result bool, err error) { | ||
| selectedSecrets, err = secretsClient.List(ctx, metav1.ListOptions{LabelSelector: labelSelector}) | ||
| if err != nil { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's use transientAPIError - makes the test less brittle
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as mentioned earlier on slack and on the other thread with the ai rabbit: it doesn't cover all transient errors
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, but right now we have a mix. Some tests use transientAPIError and some don’t. Are there any known transient errors we’re currently missing? Would it make sense to add them to transientAPIError? In general, do we currently have issues with transient errors? I think it would be better not to hide any errors. At the moment, we treat all errors as transient. Using transientAPIError instead would raise the bar for the entire platform, and I think we’re already doing a good job since the tests are generally stable :) WDYT? |
||
| t.Logf("failed to list secrets, err = %v", err.Error()) | ||
| t.Logf("GetLastKeyMeta: Failed to list secrets: %v", err) | ||
| return false, nil | ||
| } | ||
| return | ||
|
|
||
| return true, nil | ||
| }) | ||
|
|
||
| if err != nil { | ||
| return EncryptionKeyMeta{}, err | ||
| } | ||
|
|
||
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.
would it make sense to preserve this comment ? (it explains why 5m)
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 comment is still there
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.
oh, ok.