Skip to content
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

pkg/search/controllers_test: address flaky test [WIP] #5875

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mohamedawnallah
Copy link
Contributor

@mohamedawnallah mohamedawnallah commented Nov 25, 2024

Description

This PR introduces two key changes, which may address flaky test cases:

  • Sets the default resync period for the shared informer to one second, instead of zero, ensuring that the informer checks for changes at regular intervals, reducing the chance of missing updates.
  • Ensures that the shared informer is shut down after completion, guaranteeing that all goroutines have terminated, which helps avoid any lingering processes that could interfere with test execution.

What type of PR is this?

/kind flake

What this PR does / why we need it:

Which issue(s) this PR fixes:
There are flake tests regards some test cases in search controller as found in this PR #5864.

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@karmada-bot
Copy link
Collaborator

[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 huntsman-li for approval. For more information see the Kubernetes Code Review Process.

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

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

@mohamedawnallah mohamedawnallah changed the title pkg/search/controllers_test: address flake test pkg/search/controllers_test: address flake test [WIP] Nov 25, 2024
@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 25, 2024
@XiShanYongYe-Chang
Copy link
Member

Thanks~ @mohamedawnallah How does it work?

@mohamedawnallah
Copy link
Contributor Author

mohamedawnallah commented Nov 25, 2024

Thanks~ @mohamedawnallah How does it work?

@XiShanYongYe-Chang, I've updated the PR description how these changes may fix these flaky test cases. That said it may pass this time in CI, which isn't detrimental if the test cases are no longer flaky. I've run the test cases again locally 100 times, and all passed. One point I observed is that the shared informer sometimes doesn't receive changes, meaning the upserted cluster from the watch API in the fake client is not detected. As a result, the invoke handlers are not triggered, and the system waits in the queue for elements, leading to the timeout issue. I'm curious, though—are the unit tests in CI running in parallel?

@codecov-commenter
Copy link

codecov-commenter commented Nov 25, 2024

⚠️ 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 46.26%. Comparing base (88c3e44) to head (dcb6ab7).
Report is 6 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5875      +/-   ##
==========================================
+ Coverage   46.20%   46.26%   +0.06%     
==========================================
  Files         663      663              
  Lines       54580    54621      +41     
==========================================
+ Hits        25218    25272      +54     
+ Misses      27739    27723      -16     
- Partials     1623     1626       +3     
Flag Coverage Δ
unittests 46.26% <ø> (+0.06%) ⬆️

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

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


🚨 Try these New Features:

@mohamedawnallah
Copy link
Contributor Author

mohamedawnallah commented Nov 25, 2024

@XiShanYongYe-Chang The unit tests passed this time in the CI. What do you think about the changes in this PR? We may also keep an eye on it since for every PR submitted to the repo the unit tests will be triggered?

@XiShanYongYe-Chang
Copy link
Member

We may also keep an eye on it since for every PR submitted to the repo the unit tests will be triggered?

I'm leaning towards this, so that we can test a little more before we incorporate it.

@mohamedawnallah mohamedawnallah changed the title pkg/search/controllers_test: address flake test [WIP] pkg/search/controllers_test: address flaky test [WIP] Nov 25, 2024
@XiShanYongYe-Chang
Copy link
Member

Hi @mohamedawnallah please remember to push this pr again from time to time every day.

@mohamedawnallah
Copy link
Contributor Author

✅2️⃣ Unit tests passed on the second run—no flaky test cases: GitHub Actions Logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants