test(h2): cover stream reset with NGHTTP2_INTERNAL_ERROR - #5725
Open
zeexzeex wants to merge 1 commit into
Open
Conversation
A stream reset before the response headers arrive settles the request promise with ERR_HTTP2_STREAM_ERROR carrying the reset code. This is a different path from a plain stream.close(), which surfaces an InformationalError, so the existing coverage does not exercise it. Add tests asserting that such a request rejects with the expected code and that the failed stream does not prevent other requests on the same connection from completing. Refs: nodejs#2675
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5725 +/- ##
==========================================
- Coverage 93.47% 93.46% -0.01%
==========================================
Files 110 110
Lines 38908 38908
==========================================
- Hits 36368 36366 -2
- Misses 2540 2542 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
A stream reset before the response headers arrive settles the request promise
with
ERR_HTTP2_STREAM_ERROR, carrying the reset code inhttp2ErrorCode.That is a different path from a plain
stream.close(), which surfaces anInformationalError:codehttp2ErrorCodestream.close()UND_ERR_INFOstream.close(INTERNAL_ERROR)ERR_HTTP2_STREAM_ERROR2stream.close(CANCEL)UND_ERR_INFOtest/http2-destroy-after-failed-stream.jscovers the first row, and the onlyexisting use of
NGHTTP2_INTERNAL_ERRORin the test suite is a session-levelgoaway(). The stream-level reset path is currently untested.Changes
Adds two tests:
NGHTTP2_INTERNAL_ERRORrejects withthe expected
codeandhttp2ErrorCodefrom completing
No production code is changed; this only pins down existing behaviour.
I verified the tests actually catch a regression by removing the
state.abort(err)call inonError(reproducing the behaviour reported in#2675) and confirming both tests fail, then restoring it.
Refs: #2675