TestMultiDocFailsWhenVLANHasNoParent pins that the renderer surfaces a clear error when a VLAN link discovered without a resolvable parent reaches the VLANConfig branch — Talos rejects a VLANConfig without the required parent field, and silently emitting one would surface the rejection on the apply
(t *testing.T)
| 1981 | // emitting one would surface the rejection on the apply RPC instead |
| 1982 | // of at template time. |
| 1983 | func TestMultiDocFailsWhenVLANHasNoParent(t *testing.T) { |
| 1984 | origLookup := helmEngine.LookupFunc |
| 1985 | t.Cleanup(func() { helmEngine.LookupFunc = origLookup }) |
| 1986 | helmEngine.LookupFunc = vlanWithoutParentLookup() |
| 1987 | |
| 1988 | chrt, err := loader.LoadDir("../../charts/cozystack") |
| 1989 | if err != nil { |
| 1990 | t.Fatalf("load chart: %v", err) |
| 1991 | } |
| 1992 | values := cloneValues(chrt.Values) |
| 1993 | if v, _ := values["endpoint"].(string); v == "" { |
| 1994 | values["endpoint"] = testEndpoint |
| 1995 | } |
| 1996 | if arr, ok := values["advertisedSubnets"].([]any); !ok || len(arr) == 0 { |
| 1997 | values["advertisedSubnets"] = []any{testAdvertisedSubnet} |
| 1998 | } |
| 1999 | |
| 2000 | eng := helmEngine.Engine{} |
| 2001 | _, err = eng.Render(chrt, chartutil.Values{ |
| 2002 | "Values": values, |
| 2003 | "TalosVersion": "v1.12", |
| 2004 | }) |
| 2005 | if err == nil { |
| 2006 | t.Fatal("expected render to fail when a VLAN link is missing a resolvable parent — emitting VLANConfig without the required parent field is rejected by Talos at apply time") |
| 2007 | } |
| 2008 | if !strings.Contains(err.Error(), "parent") { |
| 2009 | t.Errorf("fail message must name the missing parent link so the operator knows what to fix, got: %v", err) |
| 2010 | } |
| 2011 | } |
| 2012 | |
| 2013 | // TestMultiDocBondSlavesNotEmittedAsLinkConfig pins that bond slaves |
| 2014 | // (physical NICs enrolled into a bond) do NOT get their own |
nothing calls this directly
no test coverage detected