test: wait for the server to LISTEN instead of a fixed 300ms
Cold Postgres boot (connect + apply the full schema) takes a few seconds — the fixed 300ms that was fine for SQLite's instant in-memory init raced the server bind and the first fetch hit ECONNREFUSED. Poll BASE/ until it responds (≤30s). Validated on local PostgreSQL 16: db-smoke 22/22 pass; e2e passes all DB-backed checks (auth, messages, polls, groups, calls+invite, meetings) then stops at the known pre-existing WS meeting-joined flake (unrelated to the DB). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,9 @@ async function get(p, cookie) {
|
||||
}
|
||||
|
||||
(async () => {
|
||||
await wait(300);
|
||||
// Wait for the server to actually be LISTENING — a cold Postgres boot (connect + apply the full schema)
|
||||
// takes a few seconds, well past the fixed 300ms that was fine for SQLite's instant in-memory init.
|
||||
for (let i = 0; i < 150; i++) { try { await fetch(BASE + '/'); break; } catch (_) { await wait(200); } }
|
||||
console.log('DB smoke tests (backend=' + process.env.DB_BACKEND + '):');
|
||||
|
||||
// Auth
|
||||
|
||||
Reference in New Issue
Block a user