Skip to content

fix(e2e): fix checkPolicy logic bug and improve underlay test diagnostics#6346

Merged
oilbeater merged 2 commits intomasterfrom
fix/u2o-e2e-timeout
Feb 26, 2026
Merged

fix(e2e): fix checkPolicy logic bug and improve underlay test diagnostics#6346
oilbeater merged 2 commits intomasterfrom
fix/u2o-e2e-timeout

Conversation

@oilbeater
Copy link
Copy Markdown
Collaborator

Summary

  • Fix checkPolicy() logic bug: when expectPolicyExist=false, the original code returned true as soon as the first line did not contain the policy string, without scanning remaining lines. Now it correctly scans all lines before comparing against the expectation.
  • Increase checkPolicy() timeout from 10s to 30s, consistent with other wait functions (waitSubnetStatusUpdate, waitSubnetU2OStatus).
  • Add meaningful condDesc to waitSubnetStatusUpdate(), waitSubnetU2OStatus(), and checkPolicy() so timeout failures produce actionable error messages instead of empty strings like timed out while waiting for the condition to be met: .
  • Replace ginkgo.By() with framework.Logf() inside polling loops in waitSubnetU2OStatus() to reduce noisy test output.

Test plan

  • Verify the "should support underlay to overlay subnet interconnection" e2e test passes
  • Verify checkPolicy() correctly detects both policy presence and absence
  • Confirm timeout error messages now include descriptive condition text

🤖 Generated with Claude Code

oilbeater and others added 2 commits February 26, 2026 05:02
The waitSubnetU2OStatus() function waits for the Subnet.Status.U2OInterconnectionVPC
field to be populated, which requires coordination between the Subnet Controller
and VPC Controller. This is a cross-controller operation that involves:

1. Subnet Controller setting U2OInterconnectionIP (100-500ms)
2. VPC Controller updating VPC.Status.Router (100-500ms)
3. Subnet Controller reading VPC.Status.Router and setting U2OInterconnectionVPC (500-2000ms)

The total operation can take 500-2500ms, which exceeds the original 3 second timeout.
This causes intermittent test failures, especially after controller restarts.

The fix increases the timeout to 30 seconds, consistent with waitSubnetStatusUpdate()
and the framework's default timeout of 2 minutes. This provides adequate buffer for
normal operation while still detecting real failures.

Fixes intermittent timeouts in "should support underlay to overlay subnet interconnection" test.

Co-Authored-By: Mengxin Liu <liumengxinfly@gmail.com>
…tics

1. Fix checkPolicy() logic bug: when expectPolicyExist=false, the
   original code returned true as soon as the first line did not contain
   the policy, without checking remaining lines. Now it scans all lines
   to determine whether the policy exists, then compares against the
   expectation.

2. Increase checkPolicy() timeout from 10s to 30s, consistent with
   other wait functions in the test.

3. Add meaningful condDesc to waitSubnetStatusUpdate(),
   waitSubnetU2OStatus(), and checkPolicy() so timeout failures produce
   actionable error messages instead of empty descriptions.

4. Replace ginkgo.By() with framework.Logf() inside polling loops in
   waitSubnetU2OStatus() to avoid excessive test output.

Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com>
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 26, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @oilbeater, 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 and diagnostic capabilities of end-to-end tests for Kube-OVN's underlay-to-overlay subnet interconnection. It addresses a critical logic flaw in the checkPolicy() function, standardizes wait timeouts, and significantly improves the clarity of error messages during test failures, while also reducing unnecessary log output.

Highlights

  • checkPolicy() logic fix: Corrected a bug in checkPolicy() where it prematurely returned true when expectPolicyExist=false, ensuring all policy lines are scanned before comparison.
  • Timeout adjustments: Increased the timeout for checkPolicy() and waitSubnetU2OStatus() from 10s/3s to 30s for consistency and robustness in e2e tests.
  • Improved diagnostic messages: Added meaningful condition descriptions (condDesc) to waitSubnetStatusUpdate(), waitSubnetU2OStatus(), and checkPolicy() to provide actionable error messages on timeout.
  • Reduced log verbosity: Replaced ginkgo.By() with framework.Logf() within polling loops in waitSubnetU2OStatus() to minimize noisy test output.
Changelog
  • test/e2e/kube-ovn/underlay/underlay.go
    • Added a descriptive condition message to waitSubnetStatusUpdate to improve timeout diagnostics.
    • Increased the timeout duration for waitSubnetU2OStatus from 3 seconds to 30 seconds, replaced ginkgo.By calls with framework.Logf for cleaner logging, and added a descriptive condition message.
    • Fixed a logical error in checkPolicy's policy existence checking, extended its timeout from 10 seconds to 30 seconds, and included a descriptive condition message for better error reporting.
Activity
  • The pull request was generated using Claude Code.
  • A test plan was provided, including verification of the "should support underlay to overlay subnet interconnection" e2e test, checkPolicy() correctness, and improved timeout error messages.
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.

@dosubot dosubot bot added bug Something isn't working test automation tests labels Feb 26, 2026
Copy link
Copy Markdown
Contributor

@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 effectively addresses a logic bug in the checkPolicy function and significantly improves the diagnostics and stability of the underlay e2e tests. The fix in checkPolicy is correct and ensures proper behavior when checking for policy absence. Increasing timeouts to 30s for wait functions is a good step towards reducing test flakiness. The addition of descriptive messages for wait conditions and the cleanup of logging within polling loops are excellent improvements for maintainability and debugging. Overall, these are solid enhancements to the test suite.

I am having trouble creating individual review comments. Click here to see my feedback.

test/e2e/kube-ovn/underlay/underlay.go (94-95)

medium

Removing this redundant log statement is a good cleanup. However, similar redundant framework.Logf calls still exist within the if enableU2O block (lines 79-80 and 85-86 in the file). These logs are also triggered when the wait condition is met. For consistency and to further reduce log noise, consider removing those logging statements as well.

@oilbeater oilbeater merged commit 21594f7 into master Feb 26, 2026
73 of 75 checks passed
@oilbeater oilbeater deleted the fix/u2o-e2e-timeout branch February 26, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files. test automation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant