mirror of
https://github.com/golang/go
synced 2024-11-17 08:04:46 -07:00
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>
This commit is contained in:
parent
e246cf626d
commit
4412230503
@ -4429,8 +4429,19 @@ func testTransportReuseConnection_Gzip(t *testing.T, chunked bool) {
|
||||
defer ts.Close()
|
||||
c := ts.Client()
|
||||
|
||||
trace := &httptrace.ClientTrace{
|
||||
GetConn: func(hostPort string) { t.Logf("GetConn(%q)", hostPort) },
|
||||
GotConn: func(ci httptrace.GotConnInfo) { t.Logf("GotConn(%+v)", ci) },
|
||||
PutIdleConn: func(err error) { t.Logf("PutIdleConn(%v)", err) },
|
||||
ConnectStart: func(network, addr string) { t.Logf("ConnectStart(%q, %q)", network, addr) },
|
||||
ConnectDone: func(network, addr string, err error) { t.Logf("ConnectDone(%q, %q, %v)", network, addr, err) },
|
||||
}
|
||||
ctx := httptrace.WithClientTrace(context.Background(), trace)
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
res, err := c.Get(ts.URL)
|
||||
req, _ := NewRequest("GET", ts.URL, nil)
|
||||
req = req.WithContext(ctx)
|
||||
res, err := c.Do(req)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user