test: add unexpected disconnect guards to more client test files#4844
Open
samayer12 wants to merge 12 commits intonodejs:mainfrom
Open
test: add unexpected disconnect guards to more client test files#4844samayer12 wants to merge 12 commits intonodejs:mainfrom
samayer12 wants to merge 12 commits intonodejs:mainfrom
Conversation
samayer12
commented
Feb 27, 2026
5c94a36 to
8e69a9f
Compare
metcoder95
reviewed
Mar 2, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4844 +/- ##
==========================================
- Coverage 93.02% 93.01% -0.02%
==========================================
Files 112 112
Lines 35157 35157
==========================================
- Hits 32705 32701 -4
- Misses 2452 2456 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a88b414 to
8e69a9f
Compare
Signed-off-by: Sam Mayer <sam.mayer@datadoghq.com> Signed-off-by: Sam Mayer <sam.mayer@defenseunicorns.com>
Signed-off-by: Sam Mayer <sam.mayer@defenseunicorns.com>
…est files Signed-off-by: Sam Mayer <sam.mayer@defenseunicorns.com>
The first describe block used the global agent, leaving pooled connections alive after server.closeAllConnections() sent RST. On macOS, the async RST delivery could surface as ECONNRESET in the next describe block's fetch call. Give each block its own Client and await cleanup to eliminate the race. Signed-off-by: Sam Mayer <sam.mayer@defenseunicorns.com>
This reverts commit 29ddaeb.
This reverts commit 78d583d.
…ervers The chain limit tests ran concurrently (node:test uses Promise.all within a Suite), so a shared server was unsafe: an aborted connection's async RST delivery on macOS could corrupt the server state for a sibling test. Replace the shared before/after server with a setupChainServer(t) helper that creates an isolated server+client pair per test and binds cleanup to t.after, which is scoped to each individual test context. Also removes the keepalive: false no-op (undici documents this flag as a noop outside of browser context).
2737414 to
5cf144d
Compare
13e6c47 to
02ce816
Compare
metcoder95
reviewed
Mar 8, 2026
|
|
||
| await t.assert.rejects( | ||
| fetch(`http://localhost:${server.address().port}`, { | ||
| fetch(`http://127.0.0.1:${server.address().port}`, { |
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.
This relates to...
Relates to #251 and #4833.
Rationale
Adds disconnect guard assertions to unit tests that follow the pattern seen in #4833. This PR adds the guard to additional tests that do not already adopt the pattern, and documents it.
Changes
Disconnect guards
This PR structures tests along these lines:
Fix encoding test (Node 20 + macOS)
I noticed that there were CI issues with
test/fetch/encoding.json Node.js 20 + macOS. As part of this PR, I also changed the chain limit test server fromserver.listen(0, 'listening')to specify127.0.0.1which fixed the test failure'sECONNRESETerror. I also addedflushHeaders()and per-socketsetNoDelay()as seen in #4496.Features
N/A
Bug Fixes
N/A
Breaking Changes and Deprecations
None
Benchmarks
Status