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)
| 235 | // runHelmTemplate runs helm template on the given chart with the given values and |
| 236 | // returns the raw output. |
| 237 | func runHelmTemplate(t testing.TB, helmPath, chartDir, valuesFilePath, namespace string) (string, error) { |
| 238 | // Ensure that valuesFilePath exists |
| 239 | if _, err := os.Stat(valuesFilePath); err != nil { |
| 240 | return "", xerrors.Errorf("values file %q does not exist: %w", valuesFilePath, err) |
| 241 | } |
| 242 | |
| 243 | cmd := exec.Command(helmPath, "template", chartDir, "-f", valuesFilePath, "--namespace", namespace) |
| 244 | t.Logf("exec command: %v", cmd.Args) |
| 245 | out, err := cmd.CombinedOutput() |
| 246 | return string(out), err |
| 247 | } |
| 248 | |
| 249 | // lookupHelm ensures that Helm is available in $PATH and returns the path to the |
| 250 | // Helm executable. |
no test coverage detected