MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / TestReloadCommand

Function TestReloadCommand

internal/pgbouncer/config_test.go:205–222  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

203}
204
205func 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}

Callers

nothing calls this directly

Calls 2

ShellCheckFunction · 0.92
reloadCommandFunction · 0.70

Tested by

no test coverage detected