Repository navigation
[avenger] Fix flaky TestHeaderRoundTripper - #78420
Conversation
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
There was a problem hiding this comment.
🟡 Changes recommended
The test assumes http.DefaultTransport is always an *http.Transport, so a custom or nil global transport can cause a panic before the round trip is exercised.
1 open issue
What changed in this PR
This pull request fixes flaky integration test behavior by isolating each TestHeaderRoundTripper subtest from the shared HTTP default transport.
Changes:
- Clones the default HTTP transport for each subtest.
- Closes each private transport during cleanup.
- Preserves the existing header round-tripping assertions.
| File | Description |
|---|---|
| pkg/cli/mcp_inspect_headers_test.go | Updates TestHeaderRoundTripper to use an independent cloned HTTP transport for each subtest and clean it up afterward. |
Review effort: Lite (dynamic)
| base := http.DefaultTransport.(*http.Transport).Clone() | ||
| defer base.CloseIdleConnections() |
|
🎉 This pull request is included in a new release. Release: |

CI failure
CI run 43896838115, job "Integration: CLI Completion & Other":
TestHeaderRoundTripper/no_headersfailed withHTTP/1.x transport connection broken: http: CloseIdleConnections called.Cause
The test used the shared
http.DefaultTransport, and other parallel tests callCloseIdleConnectionson it.Fix
Each subtest now clones the default transport and uses its own copy (
pkg/cli/mcp_inspect_headers_test.go).Validation
gofmtclean;go vet -tags integration ./pkg/cli/clean.go test -tags integration ./pkg/cli -run TestHeaderRoundTripper -count=3passes.make lintand the fullmake test-unitwere not run, to stay within the runtime budget. The change is limited to one integration-tagged test file.git fetch origin mainfailed with an SSL certificate error, so the checkout was not merged with the latest main.