test(engine): pin empty-bond skip under VIP-active path#203
Conversation
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded 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. ChangesVIP-Active Empty-Bond Guardrail Contract Tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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.
| } | ||
| } |
There was a problem hiding this comment.
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")
}
What
Adds two contract tests pinning that the empty-slaves bond skip in
charts/{cozystack,generic}/templates/_helpers.tplcontinues 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