test(quinn.admin/e2e): make API boot timeout configurable
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).
This commit is contained in:
parent
15aada9bec
commit
126eae166c
1 changed files with 11 additions and 7 deletions
|
|
@ -126,12 +126,11 @@ export default async function globalSetup(): Promise<() => Promise<void>> {
|
|||
|
||||
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<void>> {
|
|||
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();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue