(t *testing.T)
| 203 | } |
| 204 | |
| 205 | func TestReloadCommand(t *testing.T) { |
| 206 | shellcheck := require.ShellCheck(t) |
| 207 | command := reloadCommand("some-name") |
| 208 | |
| 209 | // Expect a bash command with an inline script. |
| 210 | assert.DeepEqual(t, command[:3], []string{"bash", "-ceu", "--"}) |
| 211 | assert.Assert(t, len(command) > 3) |
| 212 | |
| 213 | // Write out that inline script. |
| 214 | dir := t.TempDir() |
| 215 | file := filepath.Join(dir, "script.bash") |
| 216 | assert.NilError(t, os.WriteFile(file, []byte(command[3]), 0o600)) |
| 217 | |
| 218 | // Expect shellcheck to be happy. |
| 219 | cmd := exec.CommandContext(t.Context(), shellcheck, "--enable=all", file) |
| 220 | output, err := cmd.CombinedOutput() |
| 221 | assert.NilError(t, err, "%q\n%s", cmd.Args, output) |
| 222 | } |
nothing calls this directly
no test coverage detected