Skip to content

test: fix flaky http2-dispatcher WebSocket upgrade tests#5304

Merged
mcollina merged 1 commit into
mainfrom
fix/flaky-http2-dispatcher-tests-5195
May 13, 2026
Merged

test: fix flaky http2-dispatcher WebSocket upgrade tests#5304
mcollina merged 1 commit into
mainfrom
fix/flaky-http2-dispatcher-tests-5195

Conversation

@mcollina

Copy link
Copy Markdown
Member

The CONNECT/WebSocket upgrade server handlers used stream.respond()
with the default endStream: true, immediately closing the tunnel from
the server side. This caused ECONNRESET because the HTTP/2 session
would tear down the TCP connection before queued requests could
complete or before test assertions could verify socket state.

Changes:

  • Dispatcher#Upgrade: respond with { endStream: false } to keep the
    CONNECT tunnel open, move socket error handler before assertions
  • Dispatcher#Upgrade resumes queued requests: same endStream fix,
    add server-side end handler to close tunnel when client ends,
    move error handler before assertions, simplify try-finally cleanup

Fixes: #5195

The CONNECT/WebSocket upgrade server handlers used stream.respond()
with the default endStream: true, immediately closing the tunnel from
the server side. This caused ECONNRESET because the HTTP/2 session
would tear down the TCP connection before queued requests could
complete or before test assertions could verify socket state.

Changes:
- Dispatcher#Upgrade: respond with { endStream: false } to keep the
  CONNECT tunnel open, move socket error handler before assertions
- Dispatcher#Upgrade resumes queued requests: same endStream fix,
  add server-side end handler to close tunnel when client ends,
  move error handler before assertions, simplify try-finally cleanup

Fixes: #5195
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.24%. Comparing base (314ba6a) to head (f617556).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5304      +/-   ##
==========================================
+ Coverage   93.23%   93.24%   +0.01%     
==========================================
  Files         110      110              
  Lines       36575    36575              
==========================================
+ Hits        34099    34106       +7     
+ Misses       2476     2469       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcollina mcollina merged commit f33a6cb into main May 13, 2026
38 checks passed
@mcollina mcollina deleted the fix/flaky-http2-dispatcher-tests-5195 branch May 13, 2026 17:23
@github-actions github-actions Bot mentioned this pull request May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[flaky] test/http2-dispatcher.js

3 participants