From c03725ef163dd40da41867812894a24cc28ac8e2 Mon Sep 17 00:00:00 2001 From: Jesse_Chen Date: Tue, 18 Aug 2026 00:29:06 +0800 Subject: [PATCH] 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 --- frontend/tests/helpers/postgres-fixture.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/tests/helpers/postgres-fixture.ts b/frontend/tests/helpers/postgres-fixture.ts index ac7fe505..b696e6bd 100644 --- a/frontend/tests/helpers/postgres-fixture.ts +++ b/frontend/tests/helpers/postgres-fixture.ts @@ -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",