Skip to content

fix(test): make deduplicate body-streaming test non-flaky#5196

Merged
mcollina merged 1 commit into
mainfrom
fix/flaky-deduplicate-body-streaming-test
May 5, 2026
Merged

fix(test): make deduplicate body-streaming test non-flaky#5196
mcollina merged 1 commit into
mainfrom
fix/flaky-deduplicate-body-streaming-test

Conversation

@mcollina
Copy link
Copy Markdown
Member

@mcollina mcollina commented May 5, 2026

Replace await sleep(20) with await once(res1.body, 'readable') in the "does not deduplicate requests that arrive after body streaming starts" test.

The 20ms sleep was a race — sometimes the first body chunk hadn't arrived yet, so #responseDataStarted was still false and the second request was deduplicated when it shouldn't have been.

Waiting for the readable event on the body stream guarantees the first chunk has actually been received before issuing the second request.

Fixes #5182

Replace timing-based sleep(20) with once(res.body, 'readable')
to reliably wait for the first body chunk to arrive before issuing
the second request. Fixes #5182
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5196      +/-   ##
==========================================
- Coverage   93.28%   93.26%   -0.02%     
==========================================
  Files         110      110              
  Lines       36313    36313              
==========================================
- Hits        33873    33866       -7     
- Misses       2440     2447       +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 688748a into main May 5, 2026
35 checks passed
@mcollina mcollina deleted the fix/flaky-deduplicate-body-streaming-test branch May 5, 2026 16:37
@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/interceptors/deduplicate.js

3 participants