Skip to content

test(engine): pin empty-bond skip under VIP-active path#203

Merged
lexfrei merged 1 commit into
mainfrom
test/vip-empty-bond-skip-regression-pin
May 13, 2026
Merged

test(engine): pin empty-bond skip under VIP-active path#203
lexfrei merged 1 commit into
mainfrom
test/vip-empty-bond-skip-regression-pin

Conversation

@lexfrei
Copy link
Copy Markdown
Contributor

@lexfrei lexfrei commented May 13, 2026

What

Adds two contract tests pinning that the empty-slaves bond skip in charts/{cozystack,generic}/templates/_helpers.tpl continues to hold when the VIP code path is active (floatingIP set, Layer2VIPConfig dispatch + floatingIP-strip filter + VIP-link selector all firing above the bond emission). The existing pins only exercised the no-VIP shape.

Why

A field report described an empty BondConfig{name: bond0, links: <empty>} document appearing only when floatingIP is in use. Reading the templates confirmed there is only one BondConfig emission site per preset and both already sit under the empty-slaves guard from earlier work — so the report is the pre-guard regression observed on an older talm version, not a second leak. Pinning the VIP-active variant explicitly closes the "but what if a future change re-enters the bond emission from the VIP branch" question and makes the guarantee a contract instead of an implementation accident.

No template or runtime code changes. Tests-only.

Verification

  • go test ./pkg/engine/ -run TestContract_NetworkMultidoc_BondWithoutSlaves -count=1 — 4 tests pass (no-VIP × 2 presets, VIP-active × 2 presets).
  • go test ./pkg/engine/... -count=1 — full engine suite green.
  • golangci-lint run pkg/engine/ — zero issues.

Summary by CodeRabbit

  • Tests
    • Added test coverage for Virtual IP (VIP) configuration handling in network scenarios to verify correct behavior and ensure proper rendering of related networking components when bond configurations are not utilized.

Review Change Stack

The existing empty-slaves bond skip is pinned only for the no-VIP
shape. The VIP-conditional branches above the bond emission
(Layer2VIPConfig dispatch, floatingIP-strip filter, VIP-link
selector) could in principle re-enter the bond emission without
the same guard; the existing test would not catch that. Pin the
guarantee with floatingIP set and the same empty-bond fixture for
both cozystack and generic presets.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 125de2a1-3e4e-49f4-97eb-087bee8d3273

📥 Commits

Reviewing files that changed from the base of the PR and between 92ffd52 and 333058f.

📒 Files selected for processing (1)
  • pkg/engine/contract_network_multidoc_test.go

📝 Walkthrough

Walkthrough

Added contract tests for the VIP-active empty-bond guardrail in the network multidoc engine. The tests render with floating IP enabled using the empty-bond fixture and verify that BondConfig and bond0 are not emitted, while VIP and link configuration rendering proceeds normally.

Changes

VIP-Active Empty-Bond Guardrail Contract Tests

Layer / File(s) Summary
Contract tests for VIP-active empty-bond guardrail
pkg/engine/contract_network_multidoc_test.go
TestContract_NetworkMultidoc_BondWithoutSlaves_WithVIP_SkipsBondConfig and its generic counterpart assert that floatingIP set with empty-bond fixture does not emit BondConfig/bond0 while Layer2VIPConfig and LinkConfig for eth0 render correctly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A bond unbreaked, a VIP takes flight,
Two tests now guard the guardrail tight,
No bond0 sneaks, no config stray,
The VIP path wins the day! ✨

🚥 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 clearly and concisely summarizes the main change: adding tests to pin/guard the empty-bond skip behavior when the VIP code path is active.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/vip-empty-bond-skip-regression-pin

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.

@lexfrei lexfrei marked this pull request as ready for review May 13, 2026 14:34
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 introduces two new contract tests to ensure that empty bond configurations are correctly skipped when a Virtual IP (VIP) is active, addressing issues reported in #9327 and #9351. The feedback suggests adding positive assertions to the generic test case to match the cozystack variant, ensuring that the VIP path doesn't inadvertently suppress required configuration documents like Layer2VIPConfig and LinkConfig.

Comment on lines +321 to +322
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This test is missing positive assertions to verify that other parts of the configuration are not broken. The cozystack counterpart (TestContract_NetworkMultidoc_BondWithoutSlaves_WithVIP_SkipsBondConfig) includes these checks, and as its comments explain, they are important to prevent regressions where the empty-slaves guard might accidentally suppress more than it should.

Since the generic and cozystack presets share the same multi-doc renderer logic, it would be beneficial to have the same level of contract pinning for both to ensure robustness.

	}

	// Positive-shape pin: the VIP path must still emit its
	// Layer2VIPConfig and the physical link must still render.
	assertContains(t, out, "kind: Layer2VIPConfig")
	assertContains(t, out, "kind: LinkConfig")
	assertContains(t, out, "name: eth0")
}

@lexfrei lexfrei merged commit 9cdcaeb into main May 13, 2026
8 checks passed
@lexfrei lexfrei deleted the test/vip-empty-bond-skip-regression-pin branch May 13, 2026 14:47
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