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

Function TestRestoreCommand

internal/pgbackrest/config_test.go:740–758  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

738}
739
740func TestRestoreCommand(t *testing.T) {
741 shellcheck := require.ShellCheck(t)
742
743 command := RestoreCommand(19, "/pgdata/pg13", postgres.NewParameterSet(), "--repo=1")
744
745 assert.DeepEqual(t, command[:3], []string{"bash", "-ceu", "--"})
746 assert.Assert(t, len(command) > 3)
747
748 assert.Assert(t, cmp.Contains(command[3], "/usr/pgsql-19/bin"),
749 "expected path to PostgreSQL binaries")
750
751 dir := t.TempDir()
752 file := filepath.Join(dir, "script.bash")
753 assert.NilError(t, os.WriteFile(file, []byte(command[3]), 0o600))
754
755 cmd := exec.CommandContext(t.Context(), shellcheck, "--enable=all", file)
756 output, err := cmd.CombinedOutput()
757 assert.NilError(t, err, "%q\n%s", cmd.Args, output)
758}
759
760func TestRestoreCommandPrettyYAML(t *testing.T) {
761 assert.Assert(t,

Callers

nothing calls this directly

Calls 4

ShellCheckFunction · 0.92
NewParameterSetFunction · 0.92
ContainsFunction · 0.92
RestoreCommandFunction · 0.85

Tested by

no test coverage detected