Merge test/fix-vacuous-429-test: 429 retry test now actually fires
This commit is contained in:
@@ -61,7 +61,10 @@ test.describe('Browser chaos — network', () => {
|
|||||||
const g = await guest('Throttled');
|
const g = await guest('Throttled');
|
||||||
|
|
||||||
let attempts = 0;
|
let attempts = 0;
|
||||||
await page.route('**/api/v1/feed', async (route) => {
|
// Match /api/v1/feed with or without a query string (the app requests
|
||||||
|
// `/feed?limit=20`), but NOT /api/v1/feed/delta. A plain `**/api/v1/feed` glob
|
||||||
|
// fails to match the query-string URL, so this route never fired before.
|
||||||
|
await page.route(/\/api\/v1\/feed(\?|$)/, async (route) => {
|
||||||
attempts++;
|
attempts++;
|
||||||
await route.fulfill({
|
await route.fulfill({
|
||||||
status: 429,
|
status: 429,
|
||||||
@@ -73,8 +76,13 @@ test.describe('Browser chaos — network', () => {
|
|||||||
await signIn(page, g);
|
await signIn(page, g);
|
||||||
await page.goto('/feed');
|
await page.goto('/feed');
|
||||||
|
|
||||||
// Wait until the retry count stops climbing instead of sleeping a fixed 3s: a
|
// First make sure the throttled endpoint was actually hit — otherwise the
|
||||||
// well-behaved client surfaces the 429 and stops, so the count settles quickly;
|
// stabilize-poll below could settle at attempts=0 (feed request not yet fired)
|
||||||
|
// and pass vacuously without ever exercising the 429 path.
|
||||||
|
await expect.poll(() => attempts, { timeout: 8_000 }).toBeGreaterThanOrEqual(1);
|
||||||
|
|
||||||
|
// Then wait until the retry count stops climbing instead of sleeping a fixed 3s:
|
||||||
|
// a well-behaved client surfaces the 429 and stops, so the count settles quickly;
|
||||||
// a retry storm would keep incrementing and never stabilize (→ this poll times
|
// a retry storm would keep incrementing and never stabilize (→ this poll times
|
||||||
// out and the test fails, which is the outcome we want).
|
// out and the test fails, which is the outcome we want).
|
||||||
let prev = -1;
|
let prev = -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user