Skip to content

Fix race in keepalive drain tests - #529

Merged
fredbi merged 2 commits into
masterfrom
copilot/fix-race-condition
Aug 30, 2026
Merged

Fix race in keepalive drain tests#529
fredbi merged 2 commits into
masterfrom
copilot/fix-race-condition

Conversation

Copilot AI commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

CI detected a race in TestDrainingReadCloser: tests reassigned process-global io.Discard while net/http background drain goroutines could read it.

  • Test isolation

    • Add an optional drain writer to drainingReadCloser.
    • Preserve io.Discard as the production default.
  • Race-free assertions

    • Inject per-test buffers to verify drained output without mutating global state.
discard := d.discard
if discard == nil {
    discard = io.Discard
}
_, _ = io.Copy(discard, d.rdr)

Copilot AI and others added 2 commits August 28, 2026 19:11
Co-authored-by: fredbi <14262513+fredbi@users.noreply.github.com>
Co-authored-by: fredbi <14262513+fredbi@users.noreply.github.com>
@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.16%. Comparing base (4fb7297) to head (d9bc418).
⚠️ Report is 8 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
client/keepalive.go 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #529      +/-   ##
==========================================
- Coverage   87.17%   87.16%   -0.02%     
==========================================
  Files          65       65              
  Lines        4749     4752       +3     
==========================================
+ Hits         4140     4142       +2     
- Misses        599      600       +1     
  Partials       10       10              

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

@fredbi
fredbi merged commit 2a56a00 into master Aug 30, 2026
35 of 36 checks passed
@fredbi
fredbi deleted the copilot/fix-race-condition branch August 30, 2026 16:44
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.

2 participants