MCPcopy Create free account
hub / github.com/cozystack/talm / TestMultiDocCozystack_VIPLinkOverride

Function TestMultiDocCozystack_VIPLinkOverride

pkg/engine/render_test.go:7252–7269  ·  view source on GitHub ↗

TestMultiDocCozystack_VIPLinkOverride pins the chicken-and-egg fix for nodes that need the VIP on a link that does not yet exist on the live system at first apply (typical case: a VLAN sub-interface that the same template is about to bring up). Without an override the chart would derive vipLink from

(t *testing.T)

Source from the content-addressed store, hash-verified

7250// .Values.vipLink lets the operator declare the target link up front
7251// so the rendered Layer2VIPConfig matches the post-apply network.
7252func TestMultiDocCozystack_VIPLinkOverride(t *testing.T) {
7253 result := renderCozystackWith(t, simpleNicLookup(), map[string]any{
7254 "floatingIP": "192.168.201.5",
7255 "vipLink": "eth0.4000",
7256 })
7257
7258 assertContains(t, result, "kind: Layer2VIPConfig")
7259 assertContains(t, result, "link: eth0.4000")
7260 assertNotContains(t, result, "link: eth0\n")
7261
7262 // Override-path Layer2VIPConfig must emit exactly once. The
7263 // discovery-derived block is gated on `not .Values.vipLink`, so
7264 // no second document with link: eth0 should appear alongside
7265 // the override.
7266 if c := strings.Count(result, "kind: Layer2VIPConfig"); c != 1 {
7267 t.Errorf("expected exactly one Layer2VIPConfig document, got %d:\n%s", c, result)
7268 }
7269}
7270
7271// TestMultiDocCozystack_VIPLinkOverrideOnFreshNode pins the
7272// fresh-node case for the vipLink override: a node with no

Callers

nothing calls this directly

Calls 4

renderCozystackWithFunction · 0.85
simpleNicLookupFunction · 0.85
assertContainsFunction · 0.85
assertNotContainsFunction · 0.85

Tested by

no test coverage detected