Repository navigation
Conversation
The real-transport tests in network.test.ts fail intermittently in the full suite. Other suites leave process-wide HTTP interceptors installed (nock.cleanAll() only clears expectations, and a second nock copy pulled in by @tufjs/repo-mock patches requests through MSW), so requests that should hit the local test server are intercepted instead. Run network.test.ts as a separate `oci-network` Jest project with a runner that always uses a worker process, even under --runInBand. Also restore nock for the real-transport block, match the setup file's test path on Windows separators, and assert the expected 403 proxy response rather than swallowing errors. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Brian DeHamer <bdehamer@github.com>
|
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.
The real-transport tests in
packages/oci/src/__tests__/network.test.tsfail intermittently on Linux and Windows CI runners (see the test failures on #1772 and #1773). They pass when run alone but fail when the full suite runs other suites first in the same worker.Cause
Other suites leave process-wide HTTP interceptors installed.
nock.cleanAll()only removes mock expectations, and@tufjs/repo-mockpulls in a second copy of nock (v14) that patches requests through MSW. When the network suite lands in a worker that already ran those suites, requests meant for the local test server get intercepted, which producesNock: No match for request,No socket was returned in the connect() function, and 5-second timeouts.Changes
network.test.tsas a separateoci-networkJest project. Its runner always uses a worker process, even with--runInBand, so the suite never shares a process with other suites.nock.restore()around the real-transport block so this suite's own nock instance doesn't intercept real connections./and\so proxy environment variables are cleared on Windows.403from the test proxy instead of swallowing errors, so a failed connection surfaces directly rather than as an emptyconnectsarray.No production code changes.
Testing
I reproduced the failure locally with
jest --runInBand --coverage --cache=falseand confirmed the fix with full-suite runs (99 suites, 902 tests) on Node 22.22.2 and 24.15.0, using both--runInBandand the CI--maxWorkers=2settings. I also ran the network project withHTTPS_PROXY,HTTP_PROXY, andNO_PROXYset in the environment.