Skip to content

Commit 4412230

Browse files
committed
net/http: add tracing to TestTransportReuseConnection_Gzip_*
These tests are flaky; add some additional logging in hopes it will aid in debugging. For #53373 Change-Id: I971a2815f50932a9700ef8c2f684c5416951e6de Reviewed-on: https://go-review.googlesource.com/c/go/+/432375 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
1 parent e246cf6 commit 4412230

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/net/http/transport_test.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -4429,8 +4429,19 @@ func testTransportReuseConnection_Gzip(t *testing.T, chunked bool) {
44294429
defer ts.Close()
44304430
c := ts.Client()
44314431

4432+
trace := &httptrace.ClientTrace{
4433+
GetConn: func(hostPort string) { t.Logf("GetConn(%q)", hostPort) },
4434+
GotConn: func(ci httptrace.GotConnInfo) { t.Logf("GotConn(%+v)", ci) },
4435+
PutIdleConn: func(err error) { t.Logf("PutIdleConn(%v)", err) },
4436+
ConnectStart: func(network, addr string) { t.Logf("ConnectStart(%q, %q)", network, addr) },
4437+
ConnectDone: func(network, addr string, err error) { t.Logf("ConnectDone(%q, %q, %v)", network, addr, err) },
4438+
}
4439+
ctx := httptrace.WithClientTrace(context.Background(), trace)
4440+
44324441
for i := 0; i < 2; i++ {
4433-
res, err := c.Get(ts.URL)
4442+
req, _ := NewRequest("GET", ts.URL, nil)
4443+
req = req.WithContext(ctx)
4444+
res, err := c.Do(req)
44344445
if err != nil {
44354446
t.Fatal(err)
44364447
}

0 commit comments

Comments
 (0)