Skip to content

system-tests: update ipvlan-validation.go to support IPv6 single stack#1343

Open
laurayang842 wants to merge 2 commits intorh-ecosystem-edge:mainfrom
laurayang842:ipvlan
Open

system-tests: update ipvlan-validation.go to support IPv6 single stack#1343
laurayang842 wants to merge 2 commits intorh-ecosystem-edge:mainfrom
laurayang842:ipvlan

Conversation

@laurayang842
Copy link
Copy Markdown
Contributor

@laurayang842 laurayang842 commented Apr 21, 2026

Summary by CodeRabbit

  • Tests
    • Improved IPVLAN connectivity tests to iterate over configured IPv4/IPv6 targets (rather than hard-coded permutations), assert that at least one target is configured, skip empty targets, preserve source/destination directionality across checks, and add clearer logging for diagnostics.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e1caa788-cfd5-41b1-b641-23282802a5ec

📥 Commits

Reviewing files that changed from the base of the PR and between 014d563 and 0f4fc61.

📒 Files selected for processing (1)
  • tests/system-tests/rdscore/internal/rdscorecommon/ipvlan-validation.go
✅ Files skipped from review due to trivial changes (1)
  • tests/system-tests/rdscore/internal/rdscorecommon/ipvlan-validation.go

📝 Walkthrough

Walkthrough

Two IPVLAN test verification functions were refactored to use a new helper that iterates over configured IPv4/IPv6 target addresses, asserting at least one is present, skipping empty addresses, logging each used target, and delegating per-address connectivity checks to the existing verifySRIOVConnectivity call.

Changes

Cohort / File(s) Summary
IPVLAN Test Verification Refactor
tests/system-tests/rdscore/internal/rdscorecommon/ipvlan-validation.go
Replaced multiple hard-coded verifySRIOVConnectivity calls for IPv4/IPv6 with a new verifyIPVLANTargets helper. Caller functions (VerifyIPVLANConnectivityBetweenDifferentNodes, VerifyIPVLANConnectivityOnSameNode) now assert at least one target address, iterate non-empty addresses, log each, and invoke verifySRIOVConnectivity per target while preserving source/destination label ordering.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: refactoring ipvlan-validation.go to support IPv6 single stack by introducing a helper function that handles both IPv4 and IPv6 target addresses flexibly.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@laurayang842 laurayang842 marked this pull request as ready for review April 21, 2026 21:12
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/system-tests/rdscore/internal/rdscorecommon/ipvlan-validation.go (1)

160-208: Consider extracting the repeated target-address loop into a helper.

The same pattern (assert at-least-one-configured, build a 2-element slice, iterate skipping empties, log, call verifySRIOVConnectivity) is now repeated four times across VerifyIPVLANConnectivityBetweenDifferentNodes and VerifyIPVLANConnectivityOnSameNode. Extracting a small helper would reduce duplication and make future additions (e.g., new address families) trivial.

♻️ Example helper
func verifyConnectivityForAddresses(srcNS, dstNS, srcLabel, dstLabel, deployName string, addresses ...string) {
    Expect(addresses).To(ContainElement(Not(BeEmpty())),
        fmt.Sprintf("At least one target address (IPv4 or IPv6) must be configured for %s", deployName))

    for _, targetAddress := range addresses {
        if targetAddress == "" {
            klog.V(rdscoreparams.RDSCoreLogLevel).Infof("Skipping empty address for %s", deployName)

            continue
        }

        klog.V(rdscoreparams.RDSCoreLogLevel).Infof("Access workload via %q", targetAddress)

        verifySRIOVConnectivity(srcNS, dstNS, srcLabel, dstLabel, targetAddress)
    }
}

Also minor: the "Skipping empty address %q" log always prints an empty string ("") — it could either be dropped or reworded to identify which address family was skipped (e.g., "Skipping empty IPv6 target for Deploy1").

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/system-tests/rdscore/internal/rdscorecommon/ipvlan-validation.go`
around lines 160 - 208, Extract the repeated target-address assertion+loop in
VerifyIPVLANConnectivityBetweenDifferentNodes (and the similar code in
VerifyIPVLANConnectivityOnSameNode) into a small helper, e.g.
verifyConnectivityForAddresses(srcNS, dstNS, srcLabel, dstLabel, deployName
string, addresses ...string), that asserts at least one non-empty address (using
Expect(addresses).To(ContainElement(Not(BeEmpty()))) with a deployName-specific
message), iterates skipping empty entries, logs a contextual skip message
(include deployName or address family instead of printing the empty string), and
calls verifySRIOVConnectivity(srcNS, dstNS, srcLabel, dstLabel, targetAddress);
then replace each duplicated block to call this helper with the appropriate
RDSCoreConfig fields and labels (ipvlanDeploy10Label, ipvlanDeploy11Label,
IPVlanNSOne, IPVlanDeploy1TargetAddress, IPVlanDeploy1TargetAddressIPv6, etc.).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/system-tests/rdscore/internal/rdscorecommon/ipvlan-validation.go`:
- Around line 160-208: Extract the repeated target-address assertion+loop in
VerifyIPVLANConnectivityBetweenDifferentNodes (and the similar code in
VerifyIPVLANConnectivityOnSameNode) into a small helper, e.g.
verifyConnectivityForAddresses(srcNS, dstNS, srcLabel, dstLabel, deployName
string, addresses ...string), that asserts at least one non-empty address (using
Expect(addresses).To(ContainElement(Not(BeEmpty()))) with a deployName-specific
message), iterates skipping empty entries, logs a contextual skip message
(include deployName or address family instead of printing the empty string), and
calls verifySRIOVConnectivity(srcNS, dstNS, srcLabel, dstLabel, targetAddress);
then replace each duplicated block to call this helper with the appropriate
RDSCoreConfig fields and labels (ipvlanDeploy10Label, ipvlanDeploy11Label,
IPVlanNSOne, IPVlanDeploy1TargetAddress, IPVlanDeploy1TargetAddressIPv6, etc.).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 12401a4d-486e-4604-bbc0-d939cd2fbe1e

📥 Commits

Reviewing files that changed from the base of the PR and between 4990ef3 and 014d563.

📒 Files selected for processing (1)
  • tests/system-tests/rdscore/internal/rdscorecommon/ipvlan-validation.go

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant