Skip to content

fix(test): stop http retry tail from leaking across unit tests#8794

Merged
mvaligursky merged 1 commit into
mainfrom
mv-fix-http-test-flake
May 27, 2026
Merged

fix(test): stop http retry tail from leaking across unit tests#8794
mvaligursky merged 1 commit into
mainfrom
mv-fix-http-test-flake

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

Fix flaky Http #get() unit tests that have intermittently failed CI for weeks.

Root cause:
Earlier tests (notably BundleHandler) trigger http.get with retry: true against blob URLs that fail under JSDOM with status 0. With the default Http.retryDelay = 100, each retry chain takes ~6.2 s to drain (200/400/800/1600/3200 ms). The originating test calls done() as soon as the bundle itself loads, so the retries keep firing in the background and pollute later tests — the Http describe block spies http.request and swaps global.XMLHttpRequest, so leaked retries bump call counts and intercept fake XHRs, producing expected N to equal 6 and expected 'Network error' to equal null failures.

Changes:

  • test/fixtures.mjs: set Http.retryDelay = 1 in mochaGlobalSetup so leaked retries drain in ~60 ms instead of ~6 s.

No production code changes. Two test suites already overrode Http.retryDelay = 1 per-beforeEach; this promotes that to a global setup so every test benefits.

Earlier tests trigger http.get with retry against blob URLs that fail
under JSDOM. With the default Http.retryDelay = 100, each retry chain
takes ~6.2 s to drain and bleeds into later tests that spy on
http.request or swap global.XMLHttpRequest, causing intermittent
failures in the Http describe block.

Set Http.retryDelay = 1 globally in mochaGlobalSetup so retry chains
drain in ~60 ms.
@mvaligursky mvaligursky self-assigned this May 27, 2026
@mvaligursky mvaligursky merged commit 201b3f8 into main May 27, 2026
8 checks passed
@mvaligursky mvaligursky deleted the mv-fix-http-test-flake branch May 27, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant