fix(e2e): handle neighbor entry GC race in bridge refresh test#339
fix(e2e): handle neighbor entry GC race in bridge refresh test#339fedepaol wants to merge 1 commit into
Conversation
The IPv6 migration test timed out waiting for a STALE neighbor entry because the kernel NDP state machine (STALE->DELAY->FAILED->GC) completed in ~8 seconds, faster than the test polling interval via podman exec. Introduce ErrNoNeighborEntry sentinel so callers can distinguish "entry was GC'd" from other failures, and treat a missing entry as success. Also verify the neighbor entry exists before pod deletion to confirm it was learned and not simply never created. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, 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 addresses a flaky E2E test in the IPv6 migration workflow. The test was failing due to a race condition where the kernel's neighbor discovery state machine would garbage collect an entry faster than the test could poll for it. By introducing a specific error sentinel and adding pre-migration verification, the test is now more resilient to timing variations in the kernel's neighbor table management. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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. Footnotes
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request enhances the BridgeRefresher E2E test by adding a verification step for neighbor entries before pod migration and improving the efficiency of the neighbor stale check by handling missing entries explicitly. Review feedback suggests moving the exported error variable to the top of the file to adhere to the repository's newspaper structure guidelines and using the new sentinel error in the checkNeighborExists function for consistency.
| return nil | ||
| } | ||
|
|
||
| var ErrNoNeighborEntry = errors.New("no neighbor entry") |
There was a problem hiding this comment.
The exported variable ErrNoNeighborEntry should be moved to the top of the file, following the repository's newspaper code structure guidelines (line 33). This ensures that exported symbols are easily discoverable at the beginning of the file.
References
- Exported methods and types go at the top of the file (link)
| return fmt.Errorf("failed to check neighbor on router %s: %w", exec.Name(), err) | ||
| } | ||
| if strings.TrimSpace(out) == "" { | ||
| return fmt.Errorf("no neighbor entry for %s on %s in router %s", podIP, bridgeDev, exec.Name()) |
There was a problem hiding this comment.
For consistency with checkNeighborStale, consider using the ErrNoNeighborEntry sentinel error here as well.
| return fmt.Errorf("no neighbor entry for %s on %s in router %s", podIP, bridgeDev, exec.Name()) | |
| return fmt.Errorf("%w for %s on %s in router %s", ErrNoNeighborEntry, podIP, bridgeDev, exec.Name()) |
There was a problem hiding this comment.
this could be interesting.
There was a problem hiding this comment.
Code Review
This pull request enhances the E2E bridge refresh tests by adding a verification step to ensure neighbor entries exist before pod migration. It introduces a new helper function checkNeighborExists and a specific error ErrNoNeighborEntry. Additionally, the checkNeighborStale logic was updated to treat missing neighbor entries as a successful termination condition for the wait loop, preventing unnecessary timeouts when entries expire early. I have no feedback to provide.
| err := checkNeighborStale(cs, migratingPodIPOnly, l2VNI, migratingPod.Spec.NodeName) | ||
| if errors.Is(err, ErrNoNeighborEntry) { // if the neighbor entry is expired no need to wait | ||
| return nil | ||
| } | ||
| return err | ||
| }, 3*time.Minute, 2*time.Second).ShouldNot(HaveOccurred()) |
There was a problem hiding this comment.
ok, got it.
can't we move this logic to the matcher instead ? like, the error should either: not have occurred, or match ErrNoNeighborEntry ?
I think it would read better.
| By("Verifying neighbor entry exists on the router before migration") | ||
| Eventually(func() error { | ||
| return checkNeighborExists(cs, migratingPodIPOnly, l2VNI, migratingPod.Spec.NodeName) | ||
| }, time.Minute, 2*time.Second).ShouldNot(HaveOccurred()) |
There was a problem hiding this comment.
isn't should succeed the same ? I think it reads better.
| return fmt.Errorf("failed to check neighbor on router %s: %w", exec.Name(), err) | ||
| } | ||
| if strings.TrimSpace(out) == "" { | ||
| return fmt.Errorf("no neighbor entry for %s on %s in router %s", podIP, bridgeDev, exec.Name()) |
There was a problem hiding this comment.
this could be interesting.
| out = strings.TrimSpace(out) | ||
| if out == "" { | ||
| return fmt.Errorf("no neighbor entry for %s on %s in router %s", podIP, bridgeDev, exec.Name()) | ||
| return fmt.Errorf("%w for %s on %s in router %s", ErrNoNeighborEntry, podIP, bridgeDev, exec.Name()) |
Is this a BUG FIX or a FEATURE ?:
What this PR does / why we need it:
The IPv6 migration test timed out waiting for a STALE neighbor entry
because the kernel NDP state machine (STALE->DELAY->FAILED->GC) completed
in ~8 seconds, faster than the test polling interval via podman exec.
Introduce ErrNoNeighborEntry sentinel so callers can distinguish
"entry was GC'd" from other failures, and treat a missing entry as
success. Also verify the neighbor entry exists before pod deletion
to confirm it was learned and not simply never created.
Special notes for your reviewer:
Spotted in https://github.com/openperouter/openperouter/actions/runs/24882543505/job/72855481022?pr=310
Release note: