harden e2e getState against transient /api/state 500s (ISS-127)
CI / build + unit + e2e (pull_request) Successful in 9m55s
CI / build + unit + e2e (pull_request) Successful in 9m55s
This commit is contained in:
+8
-3
@@ -47,9 +47,14 @@ interface StateBody {
|
||||
}
|
||||
|
||||
async function getState(page: Page): Promise<StateBody> {
|
||||
const res = await page.request.get('/api/state');
|
||||
expect(res.status()).toBe(200);
|
||||
return (await res.json()) as StateBody;
|
||||
// ISS-127: /api/state intermittently 500s under scale-1000 dind load; a throw here would
|
||||
// instantly fail any expect.poll callback, so retry briefly instead.
|
||||
for (let attempt = 1; ; attempt++) {
|
||||
const res = await page.request.get('/api/state');
|
||||
if (res.status() === 200) return (await res.json()) as StateBody;
|
||||
if (attempt >= 3) throw new Error(`/api/state returned ${res.status()} after 3 attempts`);
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
}
|
||||
|
||||
// Test hook (FLIGHT_TEST_HOOKS=1): set the world rate and VERIFY from the response that it stuck.
|
||||
|
||||
Reference in New Issue
Block a user