test(db): report why PostgreSQL refused to start before tearing it down
The fixture removes the container as soon as startup fails, so every CI failure reduced to one line: the container is unhealthy. The server's own account of the refusal is deleted with it, which leaves a reproducible staging-gate failure undiagnosable from the log alone. Print the container log before the teardown runs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -115,6 +115,16 @@ export function startPostgresFixture(): PostgresFixture {
|
||||
);
|
||||
} catch (error) {
|
||||
try {
|
||||
try {
|
||||
// The teardown below deletes the only account of why the server refused to start.
|
||||
execFileSync(
|
||||
"docker",
|
||||
[...composeArguments, "logs", "--no-color", "--tail", "80", "postgres"],
|
||||
{ env: environment, stdio: "inherit" },
|
||||
);
|
||||
} catch {
|
||||
// Preserve the original startup failure.
|
||||
}
|
||||
try {
|
||||
execFileSync(
|
||||
"docker",
|
||||
|
||||
Reference in New Issue
Block a user