diff options
| author | Damien Neil <dneil@google.com> | 2026-03-03 15:42:57 -0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-03-12 08:10:06 -0700 |
| commit | 7f3415d80f8ea85a3c290f14d32a318923a56030 (patch) | |
| tree | 324d4e866b868cf6be3eab33cc71e89b4e1b1c73 /src/net | |
| parent | 9d3210150b470d5a740d9e7bc405d863846ef999 (diff) | |
| download | go-7f3415d80f8ea85a3c290f14d32a318923a56030.tar.xz | |
net/http/internal/http2: remove TestTransportGroupsPendingDials
This test exercises dials in the client connection pool inside
http2.Transport, but in the merged-into-std world dials are
always handled by the net/http.Transport.
For #67810
Change-Id: Ic047ec3628c48116f1eda3c145bf5a566a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/751309
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/http/internal/http2/transport_test.go | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/src/net/http/internal/http2/transport_test.go b/src/net/http/internal/http2/transport_test.go index 1acb78f901..ac55d86b27 100644 --- a/src/net/http/internal/http2/transport_test.go +++ b/src/net/http/internal/http2/transport_test.go @@ -479,77 +479,6 @@ func testTransportGetGotConnHooks(t *testing.T, useClient bool) { } } -type testNetConn struct { - net.Conn - closed bool - onClose func() -} - -func (c *testNetConn) Close() error { - if !c.closed { - // We can call Close multiple times on the same net.Conn. - c.onClose() - } - c.closed = true - return c.Conn.Close() -} - -// Tests that the Transport only keeps one pending dial open per destination address. -// https://golang.org/issue/13397 -func TestTransportGroupsPendingDials(t *testing.T) { - ts := newTestServer(t, func(w http.ResponseWriter, r *http.Request) { - }) - var ( - mu sync.Mutex - dialCount int - closeCount int - ) - tr := &Transport{ - TLSClientConfig: tlsConfigInsecure, - DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) { - mu.Lock() - dialCount++ - mu.Unlock() - c, err := tls.Dial(network, addr, cfg) - return &testNetConn{ - Conn: c, - onClose: func() { - mu.Lock() - closeCount++ - mu.Unlock() - }, - }, err - }, - } - defer tr.CloseIdleConnections() - var wg sync.WaitGroup - for i := 0; i < 10; i++ { - wg.Add(1) - go func() { - defer wg.Done() - req, err := http.NewRequest("GET", ts.URL, nil) - if err != nil { - t.Error(err) - return - } - res, err := tr.RoundTrip(req) - if err != nil { - t.Error(err) - return - } - res.Body.Close() - }() - } - wg.Wait() - tr.CloseIdleConnections() - if dialCount != 1 { - t.Errorf("saw %d dials; want 1", dialCount) - } - if closeCount != 1 { - t.Errorf("saw %d closes; want 1", closeCount) - } -} - func TestTransportAbortClosesPipes(t *testing.T) { shutdown := make(chan struct{}) ts := newTestServer(t, |
