fix(test): stop http retry tail from leaking across unit tests#8794
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix flaky
Http #get()unit tests that have intermittently failed CI for weeks.Root cause:
Earlier tests (notably
BundleHandler) triggerhttp.getwithretry: trueagainst blob URLs that fail under JSDOM with status 0. With the defaultHttp.retryDelay = 100, each retry chain takes ~6.2 s to drain (200/400/800/1600/3200 ms). The originating test callsdone()as soon as the bundle itself loads, so the retries keep firing in the background and pollute later tests — theHttpdescribe block spieshttp.requestand swapsglobal.XMLHttpRequest, so leaked retries bump call counts and intercept fake XHRs, producingexpected N to equal 6andexpected 'Network error' to equal nullfailures.Changes:
test/fixtures.mjs: setHttp.retryDelay = 1inmochaGlobalSetupso leaked retries drain in ~60 ms instead of ~6 s.No production code changes. Two test suites already overrode
Http.retryDelay = 1per-beforeEach; this promotes that to a global setup so every test benefits.