From 126eae166c70f6c4c4ceffa800f20fa2db77b8b9 Mon Sep 17 00:00:00 2001 From: Natalie Date: Sun, 21 Jun 2026 16:20:17 -0500 Subject: [PATCH] test(quinn.admin/e2e): make API boot timeout configurable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A cold ephemeral DB runs the full migration set before serving — seconds on the black CI runner (local PG), minutes over the mesh from plum. Make the wait-for-port budget overridable via QUINN_ADMIN_E2E_BOOT_TIMEOUT_MS (default 60s) and clarify the bun-runtime rationale (matches prod quinn.admin-api). --- .../@domains/quinn.admin/e2e/global-setup.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/deployments/@domains/quinn.admin/e2e/global-setup.ts b/deployments/@domains/quinn.admin/e2e/global-setup.ts index 422ab411..8d78c537 100644 --- a/deployments/@domains/quinn.admin/e2e/global-setup.ts +++ b/deployments/@domains/quinn.admin/e2e/global-setup.ts @@ -126,12 +126,11 @@ export default async function globalSetup(): Promise<() => Promise> { await createEphemeralDb(); - // Run the API under bun (not node): the rest of the @features/api test infra - // connects to the Postgres test server under bun, and node's postgres.js - // connection flakes with a spurious CONNECT_TIMEOUT over the mesh from plum - // even though raw TCP connects in <2s. The bundle supports both runtimes - // (it serves via Bun.serve when `typeof Bun !== 'undefined'`, node-server - // otherwise — server.ts:513). + // Run the API under bun to match production (quinn.admin-api services.yaml: + // `startCommand: bun dev`). The bundle supports both runtimes — it serves via + // Bun.serve when `typeof Bun !== 'undefined'`, node-server otherwise + // (server.ts:513). Intended to run on the black CI runner, where Postgres is + // local; from plum the migration stream can stall on mesh packet loss. const proc = spawn('bun', ['dist/server.node.js'], { cwd: API_DIR, env: { @@ -153,7 +152,12 @@ export default async function globalSetup(): Promise<() => Promise> { proc.stderr?.on('data', (d: Buffer) => process.stderr.write(`[api] ${d}`)); try { - await waitForPort(TEST_PORT, 30_000); + // Cold ephemeral DB: the API runs the full migration set before it serves. + // On the black CI runner (local Postgres) this is seconds; over the mesh + // from plum every round-trip costs 250-800ms and the full set takes minutes, + // so the budget is overridable via QUINN_ADMIN_E2E_BOOT_TIMEOUT_MS. + const bootTimeoutMs = Number(process.env['QUINN_ADMIN_E2E_BOOT_TIMEOUT_MS'] ?? 60_000); + await waitForPort(TEST_PORT, bootTimeoutMs); } catch (err) { proc.kill('SIGTERM'); await dropEphemeralDb();