Skip to content

test: stabilize HTTP client tests for read after timeout and connection reuse - #2373

Merged
vdusek merged 1 commit into
v2from
fix/http-client-test-flakes
Oct 31, 2026
Merged

vdusek merged 1 commit into
v2from
fix/http-client-test-flakes

Conversation

@vdusek

@vdusek vdusek commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Two tests added in #2349 fail intermittently in CI (seen on #2371).

  • test_closing_unread_response_reuses_connection[impit]: impit returns a drained connection to its pool in the background, so the request sent right after a close sometimes opens a second connection. Under load this failed in 2 of 120 local runs. The test now allows up to two connections. A working client opens 1 or 2, and one that drops the connections of closed responses always opens 3 (300 runs each), so the test still catches that regression.
  • test_read_again_after_timeout[httpx]: the 200 ms timeout covered the whole request, and the slow macOS runner didn't get the headers in time. The test now uses a 10 s timeout and moves the event loop clock past the deadline before the second read(), so it doesn't wait on the wall clock.

Both tests still fail when the behavior they cover is broken. After the change, 1,440 runs under load passed.

✍️ Drafted by Claude Code

@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels Oct 31, 2026
@vdusek vdusek self-assigned this Oct 31, 2026
@vdusek
vdusek marked this pull request as ready for review October 31, 2026 06:38
@vdusek
vdusek merged commit 6d6aceb into v2 Oct 31, 2026
36 checks passed
@vdusek
vdusek deleted the fix/http-client-test-flakes branch October 31, 2026 06:39
@codecov

codecov Bot commented Oct 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (v2@9aba398). Learn more about missing BASE report.

Additional details and impacted files
@@          Coverage Diff          @@
##             v2    #2373   +/-   ##
=====================================
  Coverage      ?   94.29%           
=====================================
  Files         ?      187           
  Lines         ?    13838           
  Branches      ?        0           
=====================================
  Hits          ?    13048           
  Misses        ?      790           
  Partials      ?        0           
Flag Coverage Δ
unit 94.29% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant