Skip to content

Conversation

@zhzhuang-zju
Copy link
Contributor

What type of PR is this?
/kind flake

What this PR does / why we need it:
When GracePeriodSeconds is configured by the user, if an application becomes unhealthy and triggers an application failover, it will wait for GracePeriodSeconds before deleting the unhealthy replicas in that cluster. In e2e tests, we cannot accurately determine the total time for the entire application failover, so we can only make a relative comparison. The current start time of the application failover is not precise enough, leading to occasional failures in judgment.

Which issue(s) this PR fixes:

Part of #6841

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

None.

@karmada-bot karmada-bot added the kind/flake Categorizes issue or PR as related to a flaky test. label Oct 17, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @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 reliability of end-to-end application failover tests. It specifically targets an issue where the timing of failover events, particularly when GracePeriodSeconds is configured, was not accurately captured, leading to test flakiness. By refining the timestamp capture mechanism to record the start time earlier, the PR ensures a more precise measurement of failover duration, thereby improving test stability.

Highlights

  • E2E Test Reliability: Improved the accuracy of application failover time measurement in e2e tests by adjusting the beginTime capture point. This addresses flakiness caused by imprecise timing when GracePeriodSeconds is involved.
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 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 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

  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 karmada-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 17, 2025
@zhzhuang-zju
Copy link
Contributor Author

cc @XiShanYongYe-Chang

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 addresses a flaky e2e test for application failover. The change correctly moves the start time measurement (beginTime = time.Now()) to before the creation of the OverridePolicy. This ensures that the time taken for the policy creation API call is included in the total failover duration measurement, making the test assertion more robust and less prone to timing-related failures. The change is logical and directly addresses the problem described. The code looks good.

@codecov-commenter
Copy link

codecov-commenter commented Oct 17, 2025

⚠️ 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 45.65%. Comparing base (3bdee54) to head (9e74488).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6845   +/-   ##
=======================================
  Coverage   45.64%   45.65%           
=======================================
  Files         692      692           
  Lines       57580    57580           
=======================================
+ Hits        26283    26286    +3     
+ Misses      29658    29656    -2     
+ Partials     1639     1638    -1     
Flag Coverage Δ
unittests 45.65% <ø> (+<0.01%) ⬆️

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.

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

@XiShanYongYe-Chang
Copy link
Member

Isn't adding some logs convenient for later troubleshooting when encountering problems?

@zhzhuang-zju
Copy link
Contributor Author

Isn't adding some logs convenient for later troubleshooting when encountering problems?

Good idea! done~

Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge it first and see if the occasional errors still occur.
/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 17, 2025
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: XiShanYongYe-Chang

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 17, 2025
@karmada-bot karmada-bot merged commit 03fb1bf into karmada-io:master Oct 17, 2025
24 checks passed
@zhzhuang-zju
Copy link
Contributor Author

Let's merge it first and see if the occasional errors still occur. /lgtm /approve

@XiShanYongYe-Chang Should we backport this to previous releases?

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/flake Categorizes issue or PR as related to a flaky test. lgtm Indicates that a PR is ready to be merged. 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.

4 participants