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>
This commit is contained in:
Damien Neil
2026-03-03 15:42:57 -08:00
committed by Gopher Robot
parent 9d3210150b
commit 7f3415d80f

View File

@@ -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,