renderExpectingError calls the Helm engine directly with the given chart, lookup, values, and talosVersion. Returns the raw error from helm Render so the test can assert on the message body. Unlike renderChartTemplate, this helper does not call t.Fatal on failure — failure IS the contract under test
(t *testing.T, chartPath, talosVersion string, lookup func(string, string, string) (map[string]any, error), values map[string]any)
| 52 | // failure IS the contract under test. A successful render is the |
| 53 | // failure case: an unexpected absence of the error. |
| 54 | func renderExpectingError(t *testing.T, chartPath, talosVersion string, lookup func(string, string, string) (map[string]any, error), values map[string]any) error { |
| 55 | t.Helper() |
| 56 | |
| 57 | origLookup := helmEngine.LookupFunc |
| 58 | t.Cleanup(func() { helmEngine.LookupFunc = origLookup }) |
| 59 | if lookup != nil { |
| 60 | helmEngine.LookupFunc = lookup |
| 61 | } else { |
| 62 | helmEngine.LookupFunc = helmEngineEmptyLookup |
| 63 | } |
| 64 | |
| 65 | chrt, err := loader.LoadDir(chartPath) |
| 66 | if err != nil { |
| 67 | t.Fatalf("load chart %s: %v", chartPath, err) |
| 68 | } |
| 69 | |
| 70 | merged := cloneValues(chrt.Values) |
| 71 | maps.Copy(merged, values) |
| 72 | |
| 73 | eng := helmEngine.Engine{} |
| 74 | _, err = eng.Render(chrt, chartutil.Values{ |
| 75 | "Values": merged, |
| 76 | "TalosVersion": talosVersion, |
| 77 | }) |
| 78 | //nolint:wrapcheck // helm.Engine.Render returns a typed error; tests assert via require.Error/NoError. |
| 79 | return err |
| 80 | } |
| 81 | |
| 82 | // === required: endpoint === |
| 83 |
no test coverage detected