(t *testing.T, configPath string, input string, extraEnv map[string]string)
| 499 | } |
| 500 | |
| 501 | func runHTTPSSetupCommand(t *testing.T, configPath string, input string, extraEnv map[string]string) (string, error) { |
| 502 | t.Helper() |
| 503 | |
| 504 | scriptDir, err := os.Getwd() |
| 505 | if err != nil { |
| 506 | t.Fatalf("os.Getwd() error = %v", err) |
| 507 | } |
| 508 | |
| 509 | tempDir := t.TempDir() |
| 510 | cmd := exec.Command("sh", "./https-setup.sh") |
| 511 | cmd.Dir = scriptDir |
| 512 | cmd.Env = append(os.Environ(), |
| 513 | "CONFIG_FILE="+configPath, |
| 514 | "TMPDIR="+tempDir, |
| 515 | ) |
| 516 | for key, value := range extraEnv { |
| 517 | cmd.Env = append(cmd.Env, key+"="+value) |
| 518 | } |
| 519 | cmd.Stdin = strings.NewReader(input) |
| 520 | |
| 521 | output, err := cmd.CombinedOutput() |
| 522 | return string(output), err |
| 523 | } |
no test coverage detected