Conversation
undici's Client reconnects on its own, so a socket that drops mid-test is followed by a silent reconnect and the test still passes. The guard from docs/docs/best-practices/writing-tests.md turns that into a failure. http2-informational.js and http2-timeout.js keep their session up for the whole test, so an unexpected disconnect there is a real fault. Follow-up to nodejs#5686. Refs: nodejs#251
zeexzeex
force-pushed
the
test/251-h2-happy-path-guards
branch
from
September 17, 2026 05:19
9ea6630 to
61ce494
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5825 +/- ##
=======================================
Coverage 93.53% 93.53%
=======================================
Files 110 110
Lines 39773 39773
=======================================
Hits 37200 37200
Misses 2573 2573 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
metcoder95
approved these changes
Sep 17, 2026
This branch has not been deployed
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.
Adds the disconnect guard pattern from
docs/docs/best-practices/writing-tests.mdto two more HTTP/2 test files, so a silent disconnect/reconnect cycle fails the test instead of passing unnoticed. Follow-up to #5686.Files covered (3 guards):
http2-informational.js(1),http2-timeout.js(2).Of the 21
http2-*files still without a guard, these two are the only ones where an unexpected disconnect is a fault. The rest fall into four groups: the disconnect is deliberate (http2-goaway*.js,http2-abort.js,http2-refused-stream.js,http2-stream.js,http2-request-never-settles.js,http2-max-concurrent-streams-zero.js), the h2 internals are mocked with no real connection (http2-late-data.js,http2-window-size.js,http2-response-after-completion.js,http2-ping-errors.js,http2-invalid-session.js), no server is started at all (http2-resume-null-request.js,http2-stream-internal-error.js,http2-destroy-after-failed-stream.js,http2-goaway-retry-body.js), or teardown itself is under test (http2-stream-cancel.js,http2-instantiation.js).http2-invalid-connection-headers.jslooked like a candidate but is not one: the session does close there, and the test already assertsconnectCount === 2for the reconnect that follows.http2-body.jsand theconnect-*group are left for the follow-up already announced in #251.Verified: both files pass with the guards in place, and lint is clean. Note that neither guard turns a currently failing case green; they are there to catch a regression, which is what the issue asks for.
Refs: #251