TestMultiDocFailsWhenVLANHasNoVlanID pins the symmetric guardrail for the missing-vlanID case: VLANConfig requires both parent and vlanID on the wire. A VLAN discovered without a resolvable vlanID (partial discovery state) must surface a fail at template time, not silently emit a VLANConfig that Tal
(t *testing.T)
| 1927 | // vlanID (partial discovery state) must surface a fail at template |
| 1928 | // time, not silently emit a VLANConfig that Talos rejects on apply. |
| 1929 | func TestMultiDocFailsWhenVLANHasNoVlanID(t *testing.T) { |
| 1930 | origLookup := helmEngine.LookupFunc |
| 1931 | t.Cleanup(func() { helmEngine.LookupFunc = origLookup }) |
| 1932 | helmEngine.LookupFunc = vlanWithoutVlanIDLookup() |
| 1933 | |
| 1934 | chrt, err := loader.LoadDir("../../charts/cozystack") |
| 1935 | if err != nil { |
| 1936 | t.Fatalf("load chart: %v", err) |
| 1937 | } |
| 1938 | values := cloneValues(chrt.Values) |
| 1939 | if v, _ := values["endpoint"].(string); v == "" { |
| 1940 | values["endpoint"] = testEndpoint |
| 1941 | } |
| 1942 | if arr, ok := values["advertisedSubnets"].([]any); !ok || len(arr) == 0 { |
| 1943 | values["advertisedSubnets"] = []any{testAdvertisedSubnet} |
| 1944 | } |
| 1945 | |
| 1946 | eng := helmEngine.Engine{} |
| 1947 | _, err = eng.Render(chrt, chartutil.Values{ |
| 1948 | "Values": values, |
| 1949 | "TalosVersion": "v1.12", |
| 1950 | }) |
| 1951 | if err == nil { |
| 1952 | t.Fatal("expected render to fail when a VLAN link is missing vlanID — the field is required by Talos and an emitted VLANConfig without it is rejected on apply") |
| 1953 | } |
| 1954 | if !strings.Contains(err.Error(), "vlanID") { |
| 1955 | t.Errorf("fail message must name vlanID so the operator knows what is missing, got: %v", err) |
| 1956 | } |
| 1957 | } |
| 1958 | |
| 1959 | // TestMultiDocLayer2VIPLinkOnBondDefaultGateway pins that the |
| 1960 | // discovery-derived Layer2VIPConfig.link points at the bond master |
nothing calls this directly
no test coverage detected