Skip to content

Commit 46e242e

Browse files
authored
test(coderd/database/dbtestutil): add debug output to pg_dump failure (coder#20209)
1 parent 544f155 commit 46e242e

File tree

1 file changed

+3
-2
lines changed
  • coderd/database/dbtestutil

1 file changed

+3
-2
lines changed

coderd/database/dbtestutil/db.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,11 @@ func PGDump(dbURL string) ([]byte, error) {
242242
"PGCLIENTENCODING=UTF8",
243243
"PGDATABASE=", // we should always specify the database name in the connection string
244244
}
245-
var stdout bytes.Buffer
245+
var stdout, stderr bytes.Buffer
246246
cmd.Stdout = &stdout
247+
cmd.Stderr = &stderr
247248
if err := cmd.Run(); err != nil {
248-
return nil, xerrors.Errorf("exec pg_dump: %w", err)
249+
return nil, xerrors.Errorf("exec pg_dump: %w\n%s", err, stderr.String())
249250
}
250251
return stdout.Bytes(), nil
251252
}

0 commit comments

Comments
 (0)