runHelmTemplate runs helm template on the given chart with the given values and returns the raw output.
(t testing.TB, helmPath, chartDir, valuesFilePath, namespace string)
| 289 | // runHelmTemplate runs helm template on the given chart with the given values and |
| 290 | // returns the raw output. |
| 291 | func runHelmTemplate(t testing.TB, helmPath, chartDir, valuesFilePath, namespace string) (string, error) { |
| 292 | // Ensure that valuesFilePath exists |
| 293 | if _, err := os.Stat(valuesFilePath); err != nil { |
| 294 | return "", xerrors.Errorf("values file %q does not exist: %w", valuesFilePath, err) |
| 295 | } |
| 296 | |
| 297 | cmd := exec.Command(helmPath, "template", chartDir, "-f", valuesFilePath, "--namespace", namespace) |
| 298 | t.Logf("exec command: %v", cmd.Args) |
| 299 | out, err := cmd.CombinedOutput() |
| 300 | return string(out), err |
| 301 | } |
| 302 | |
| 303 | // lookupHelm ensures that Helm is available in $PATH and returns the path to the |
| 304 | // Helm executable. |
no test coverage detected