-
Notifications
You must be signed in to change notification settings - Fork 1k
e2e: Should ignore conflict when updating resources #6843
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
Conversation
Summary of ChangesHello @zhzhuang-zju, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the robustness of end-to-end tests by introducing a retry mechanism for resource update operations. By wrapping update calls in Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request aims to improve the reliability of end-to-end tests by introducing a retry mechanism for resource updates, which is a great way to handle potential conflicts. The changes across most files correctly implement a get-and-update pattern within a gomega.Eventually block. However, I've found a logical issue in test/e2e/framework/resourceregistry.go where the retry logic is implemented incorrectly and will not resolve update conflicts as intended. I've left a specific comment with a suggested fix for this issue. The other changes look solid.
XiShanYongYe-Chang
left a comment
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.
Under parallel operation, update conflicts are relatively common, so it is acceptable to retry operations in case of update conflicts. Is there similar logic elsewhere?
|
In e2e tests, common resource operations include create, update, delete, and patch. Among these, create and delete do not have this issue, and patch operations have a relatively lower chance of conflict. However, if needed, I can also enhance the patch operations in this PR to handle conflicts more robustly. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6843 +/- ##
==========================================
- Coverage 45.64% 45.62% -0.02%
==========================================
Files 692 692
Lines 57703 57703
==========================================
- Hits 26337 26329 -8
- Misses 29720 29726 +6
- Partials 1646 1648 +2
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:
|
RainbowMango
left a comment
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.
/assign
6e86719 to
bea5047
Compare
bea5047 to
2ad3afe
Compare
Signed-off-by: zhzhuang-zju <[email protected]>
2ad3afe to
71b0683
Compare
|
cc @RainbowMango @XiShanYongYe-Chang How does it look now? |
|
/genimi review |
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.
Pull Request Overview
This PR addresses flaky e2e tests by implementing retry logic with conflict handling when updating Kubernetes resources. The changes prevent test failures when concurrent modifications cause update conflicts by automatically retrying the operation with the latest resource version.
Key changes:
- Added
retry.RetryOnConflictwrapper to all resource update operations in the e2e test framework - Updated error handling to return errors from retry functions instead of using inline assertions
- Renamed
UpdateResourceRegistrytoUpdateResourceRegistryWithSpecfor consistency
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/suites/base/search_test.go | Updated function call to use renamed UpdateResourceRegistryWithSpec |
| test/e2e/framework/resourceregistry.go | Renamed function and added retry logic with conflict handling for ResourceRegistry updates |
| test/e2e/framework/resource/operator/karmada.go | Added retry logic with conflict handling for Karmada instance updates |
| test/e2e/framework/propagationpolicy.go | Added retry logic with conflict handling for PropagationPolicy updates |
| test/e2e/framework/hpa.go | Added retry logic with conflict handling for HPA updates |
| test/e2e/framework/cronfederatedhpa.go | Added retry logic with conflict handling for CronFederatedHPA updates |
| test/e2e/framework/clusterpropagationpolicy.go | Added retry logic with conflict handling for ClusterPropagationPolicy updates |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
RainbowMango
left a comment
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: RainbowMango 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 |
What type of PR is this?
/kind flake
What this PR does / why we need it:
When updating resources and a conflict occurs, the operation should retry instead of returning an error directly. This prevents unexpected e2e test failures.
Which issue(s) this PR fixes:
Fixes #6842
Parts of #6841
Special notes for your reviewer:
Does this PR introduce a user-facing change?: