renderGenericWith is the generic-preset counterpart of renderCozystackWith.
(t *testing.T, lookup func(string, string, string) (map[string]any, error), overrides map[string]any)
| 6948 | |
| 6949 | // renderGenericWith is the generic-preset counterpart of renderCozystackWith. |
| 6950 | func renderGenericWith(t *testing.T, lookup func(string, string, string) (map[string]any, error), overrides map[string]any) string { |
| 6951 | t.Helper() |
| 6952 | origLookup := helmEngine.LookupFunc |
| 6953 | t.Cleanup(func() { helmEngine.LookupFunc = origLookup }) |
| 6954 | helmEngine.LookupFunc = lookup |
| 6955 | |
| 6956 | chrt, err := loader.LoadDir("../../charts/generic") |
| 6957 | if err != nil { |
| 6958 | t.Fatalf("load chart: %v", err) |
| 6959 | } |
| 6960 | // Deep-copy chart values so mutations in this helper (or in the |
| 6961 | // caller's overrides) never leak into chrt.Values. |
| 6962 | values := cloneValues(chrt.Values) |
| 6963 | if v, _ := values["endpoint"].(string); v == "" { |
| 6964 | values["endpoint"] = testEndpoint |
| 6965 | } |
| 6966 | maps.Copy(values, overrides) |
| 6967 | |
| 6968 | eng := helmEngine.Engine{} |
| 6969 | out, err := eng.Render(chrt, chartutil.Values{ |
| 6970 | "Values": values, |
| 6971 | "TalosVersion": "v1.12", |
| 6972 | }) |
| 6973 | if err != nil { |
| 6974 | t.Fatalf("render: %v", err) |
| 6975 | } |
| 6976 | return out["generic/templates/controlplane.yaml"] |
| 6977 | } |
| 6978 | |
| 6979 | // TestMultiDocCozystack_ValidSubnetsFallsBackToDiscovery pins the |
| 6980 | // issue-report fix: when values.yaml leaves advertisedSubnets empty, |
no test coverage detected