test: fix flaky HTTP/2 reset callback check#64730
Open
trivikr wants to merge 1 commit into
Open
Conversation
The test assumed that all pending write callbacks would run within two event loop iterations after the stream closed. Callbacks for writes already handed to the socket can run later, causing a flaky assertion. Wait for the stream to close and all expected write callbacks to run before closing the server. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: codex:gpt-5.6-sol
Member
Author
|
Stress tests on |
trivikr
marked this pull request as ready for review
July 25, 2026 21:39
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #64730 +/- ##
==========================================
- Coverage 90.15% 90.14% -0.01%
==========================================
Files 743 743
Lines 242407 242407
Branches 45645 45659 +14
==========================================
- Hits 218532 218527 -5
- Misses 15357 15384 +27
+ Partials 8518 8496 -22 🚀 New features to boost your workflow:
|
inoway46
reviewed
Jul 26, 2026
inoway46
left a comment
Contributor
There was a problem hiding this comment.
LGTM. I specifically checked the removal of the explicit writeCbCount assertion: common.mustCall(..., N_WRITES) and the maybeCloseServer() gate preserve the exact-count invariant, so this removes the timing assumption without weakening the test coverage.
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.
Refs: https://github.com/nodejs/reliability/issues?q=sort%3Aupdated-desc%20test-http2-reset-happy-close
The test previously expected all pending write callbacks to run within two
setImmediate()turns after the HTTP/2 stream emitted'close'. Writecallbacks can run later when data has already been handed to the socket,
making that timing assumption unreliable under CI load.
Track stream closure and write callback completion independently, and close
the server only after both conditions are satisfied. Use
common.mustCall()to continue verifying that all 16 callbacks run. If a callback is genuinely
lost, the test harness will time out or report the callback count mismatch.
Assisted-by: codex:gpt-5.6-sol