-
Notifications
You must be signed in to change notification settings - Fork 68
🌱 Make webhook support e2es more robust #2111
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
🌱 Make webhook support e2es more robust #2111
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2111 +/- ##
=======================================
Coverage 73.60% 73.60%
=======================================
Files 78 78
Lines 7260 7260
=======================================
Hits 5344 5344
Misses 1566 1566
Partials 350 350
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5b6ca9a to
c0a263e
Compare
| if assert.NotNil(ct, cond) { | ||
| assert.Equal(ct, metav1.ConditionTrue, cond.Status) | ||
| assert.Equal(ct, ocv1.ReasonAvailable, cond.Reason) | ||
| } |
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.
At a quick glance, the current code might misleadingly suggest that if cond never becomes non-nil within the timeout, the test would not fail — giving the impression that it could pass silently.
To make this behavior more explicit and ensure that nil conditions are clearly reported during retries, I propose changing the inner logic to:
| if assert.NotNil(ct, cond) { | |
| assert.Equal(ct, metav1.ConditionTrue, cond.Status) | |
| assert.Equal(ct, ocv1.ReasonAvailable, cond.Reason) | |
| } | |
| if !assert.NotNil(t, cond) { | |
| // Keep retrying until cond is not nil | |
| return | |
| } | |
| if !assert.Equal(t, metav1.ConditionTrue, cond.Status) { | |
| // Keep retrying until condition status is true | |
| return | |
| } | |
| if !assert.Equal(t, ocv1.ReasonAvailable, cond.Reason) { | |
| // Keep retrying until reason is available | |
| return | |
| } |
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.
IHMO ^ less flake as well I think
| assert.NotEmpty(ct, clusterExtension.Status.Install.Bundle) | ||
| if assert.NotNil(ct, clusterExtension.Status.Install) { | ||
| assert.NotEmpty(ct, clusterExtension.Status.Install.Bundle) | ||
| } |
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.
Same here
| require.EventuallyWithT(t, func(ct *assert.CollectT) { | ||
| res, err = v2Client.Get(t.Context(), obj.GetName(), metav1.GetOptions{}) | ||
| require.NoError(ct, err) | ||
| }, pollDuration, pollInterval) |
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.
👍 Cool add the EventuallyWithT seems a good thing
| }, pollDuration, pollInterval) | ||
| t.Cleanup(func() { | ||
| require.NoError(t, dynamicClient.Resource(v1Gvr).Namespace(namespace.GetName()).Delete(context.Background(), obj.GetName(), metav1.DeleteOptions{})) | ||
| require.NoError(t, v1Client.Delete(context.Background(), obj.GetName(), metav1.DeleteOptions{})) |
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.
👍 seems fine for me
| require.EventuallyWithT(t, func(ct *assert.CollectT) { | ||
| res, err = v1Client.Create(t.Context(), obj, metav1.CreateOptions{}) | ||
| require.NoError(ct, err) | ||
| }, pollDuration, pollInterval) |
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.
👍 Cool add the EventuallyWithT seems a good thing
c0a263e to
6be3d45
Compare
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.
Great 👍
Terrific 🥇
|
/hold |
6be3d45 to
7a9241f
Compare
|
/unhold |
|
/hold |
7a9241f to
57cf211
Compare
|
/unhold |
57cf211 to
4a5a683
Compare
Signed-off-by: Per Goncalves da Silva <[email protected]>
4a5a683 to
f094654
Compare
|
/lgtm |
|
DON'T click the [Squash and merge] button until @grokspawn has a chance to look at tide/prow. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, grokspawn 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 |
b5a475a
into
operator-framework:main
Description
The webhook e2e tests were failing downstream. It seems that waiting for the deployment to be available is not sufficient signal to be sure that the webhook service is working. In this PR, we wrap the creation and testing of the webhook operator test CR with an Eventually to be more tolerant to transient errors of the sort:
Testing against clusterbot 4.20 techpreview:
Reviewer Checklist