(t *testing.T)
| 738 | } |
| 739 | |
| 740 | func 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 | |
| 760 | func TestRestoreCommandPrettyYAML(t *testing.T) { |
| 761 | assert.Assert(t, |
nothing calls this directly
no test coverage detected