Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions pkg/transport/proxy/transparent/backend_routing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,17 @@ func TestRoundTripDoesNotReplayInitializeOnDialError(t *testing.T) {
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Mcp-Session-Id", clientSessionID)

resp, err := http.DefaultClient.Do(req)
require.NoError(t, err)
_ = resp.Body.Close()
// A dedicated client, not http.DefaultClient: the shared transport pools
// keep-alive connections across the package's parallel tests, and reusing
// one whose proxy has since been closed surfaces here as a transport error.
client := &http.Client{Transport: &http.Transport{DisableKeepAlives: true}}
resp, err := client.Do(req)
// Either outcome is legitimate for a dial failure -- the reverse proxy may
// synthesize a 502, or the connection may fail outright. Neither is what
// this test is about; the assertions below are.
if err == nil {
_ = resp.Body.Close()
}

assert.Zero(t, targetHits.Load(),
"the proxy must not send its own initialize to the target service for an initialize dial error")
Expand Down
Loading