Skip to content

Commit c786f07

Browse files
fix(e2e): bound provision/mint/reap fetches at 45s (hang → fast retry) (#210)
playwright.live.config sets a test timeout but NO per-request timeout, so a provision (CREATE) or reap (DROP) that intermittently HANGS on postgres-customers contention runs until the whole test dies (seen as 2-3min vector/cache timeouts). A hang isn't slowness — raising the test timeout just makes it last longer. Bound the provision POST, the mint, and both reap DELETEs at 45s so a hang fails fast and Playwright retries (passes when contention clears). Pairs with the orphan-customer-DB sweep that removes the contention source. Co-authored-by: Claude <noreply@anthropic.com>
1 parent 318cd66 commit c786f07

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

e2e/cleanup-ledger.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ export async function reapEntities(
184184
method: 'DELETE',
185185
headers,
186186
failOnStatusCode: false,
187+
// Bound the reap DELETE: a DROP that hangs on postgres-customers
188+
// contention must fail fast (45s) rather than hang teardown to the test
189+
// timeout. The on-disk ledger backstop re-reaps on the next run.
190+
timeout: 45_000,
187191
})
188192
const status = resp.status()
189193
const bodyText = status >= 200 && status < 300 ? '' : await resp.text().catch(() => '<unreadable>')

e2e/factory.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ export async function mintUser(
135135
with_failed_deploy: !!opts.withFailedDeploy,
136136
}),
137137
failOnStatusCode: false,
138+
// Bound the mint: with_resources provisions real DBs server-side, which can
139+
// hang on postgres-customers contention. 45s fails fast → the spec SKIPs
140+
// (mint==null) rather than hanging the whole test on a stalled mint.
141+
timeout: 45_000,
138142
})
139143
// Inert-by-default 404: the token is wrong or the endpoint isn't armed on
140144
// this stack. Treat as "can't mint" → null (caller SKIPS), never a red.
@@ -217,6 +221,9 @@ export async function reap(request: APIRequestContext, teamID: string): Promise<
217221
method: 'DELETE',
218222
headers: { [E2E_ACCOUNT_TOKEN_HEADER]: accountToken() },
219223
failOnStatusCode: false,
224+
// Bound the cohort reap: the team-cascade drops customer DBs; a hung DROP
225+
// must fail fast (45s), not hang teardown. afterAll + ledger reaper backstop.
226+
timeout: 45_000,
220227
})
221228
const ok = [200, 202, 204, 404, 410].includes(resp.status())
222229
if (!ok) {

e2e/live-anon-provision.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@ test.describe('LIVE — every anonymous provision flow → backend-assert → re
281281
headers: id.headers,
282282
data: JSON.stringify({ name }),
283283
failOnStatusCode: false,
284+
// Bound the provision call: a CREATE that intermittently hangs on
285+
// postgres-customers contention would otherwise eat the whole test
286+
// timeout (a hang, not slowness — raising the test timeout just makes it
287+
// last longer). 45s fails fast → Playwright retries → passes on the next
288+
// attempt when the contention clears. Pairs with the orphan-DB sweep.
289+
timeout: 45_000,
284290
})
285291

286292
test.skip(

0 commit comments

Comments
 (0)