Skip to content

test(e2e): synchronize ClusterRole propagation before cleanup#7692

Open
A69SHUBHAM wants to merge 1 commit into
karmada-io:masterfrom
A69SHUBHAM:fix/e2e-clusterresourcebinding-race
Open

test(e2e): synchronize ClusterRole propagation before cleanup#7692
A69SHUBHAM wants to merge 1 commit into
karmada-io:masterfrom
A69SHUBHAM:fix/e2e-clusterresourcebinding-race

Conversation

@A69SHUBHAM

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind flake
/kind failing-test

What this PR does / why we need it:

While investigating a recent e2e failure, I noticed that the creates work with permanent ID label test in clusterresourcebinding_test.go does not follow the synchronization pattern used by similar propagation tests.

The test currently waits for the corresponding Work objects to be created in the control plane before completing. Since propagation to member clusters is asynchronous, cleanup can begin before the propagated ClusterRole has been created.

This PR adds WaitClusterRolePresentOnClustersFitWith(...) before the test completes, aligning it with the synchronization pattern already used by similar e2e tests and by the second It block in the same file.

Which issue(s) this PR fixes:

Fixes #7691

Special notes for your reviewer:

While investigating a recent e2e failure, I noticed this difference between the first and second It blocks in clusterresourcebinding_test.go. This change reuses the existing synchronization helper without changing the test assertions or production code.

Does this PR introduce a user-facing change?

NONE

Signed-off-by: A69SHUBHAM <spacekrai0@gmail.com>
Copilot AI review requested due to automatic review settings June 30, 2026 05:38
@karmada-bot karmada-bot added kind/flake Categorizes issue or PR as related to a flaky test. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. labels Jun 30, 2026
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, 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 improves the reliability of the ClusterResourceBinding e2e tests by ensuring that propagated ClusterRoles are fully synchronized across member clusters before the test proceeds to cleanup. This change aligns the test logic with established patterns in other propagation tests, effectively resolving an identified source of test flakiness.

Highlights

  • Test Synchronization: Added a synchronization step using WaitClusterRolePresentOnClustersFitWith to ensure ClusterRole propagation completes before test cleanup.
  • Test Stability: Addressed a potential race condition in the ClusterResourceBinding e2e test that was causing intermittent failures.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the 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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. 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.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@karmada-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign xishanyongye-chang for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 30, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 updates the end-to-end tests in clusterresourcebinding_test.go by adding a call to framework.WaitClusterRolePresentOnClustersFitWith to ensure that the cluster role is present on the clusters during the test execution. There are no review comments, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 an e2e flake by adding an explicit synchronization barrier in clusterresourcebinding_test.go so the test waits for asynchronous ClusterRole propagation to member clusters before cleanup begins, matching the synchronization pattern used by similar propagation tests.

Changes:

  • Add WaitClusterRolePresentOnClustersFitWith(...) to the creates work with permanent ID label test to ensure the propagated ClusterRole exists on all member clusters before the DeferCleanup disappearance check runs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 42.04%. Comparing base (ffbade9) to head (e75b9af).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7692      +/-   ##
==========================================
- Coverage   42.05%   42.04%   -0.01%     
==========================================
  Files         879      879              
  Lines       54831    54831              
==========================================
- Hits        23059    23056       -3     
- Misses      30026    30028       +2     
- Partials     1746     1747       +1     
Flag Coverage Δ
unittests 42.04% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@A69SHUBHAM

Copy link
Copy Markdown
Contributor Author

/cc @zhzhuang-zju

Can you have a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. kind/flake Categorizes issue or PR as related to a flaky test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ClusterResourceBinding e2e test misses propagation synchronization before cleanup

4 participants