Commit 3123df34 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

net/http: fix flaky TestClientRedirect308NoLocation

This was a t.Parallel test but it was using the global DefaultTransport
via the global Get func.

Use a private Transport that won't have its CloseIdleConnections etc
methods called by other tests.

(I hit this flake myself while testing a different change.)

Change-Id: If0665e3e8580ee198f8e5f3079bfaea55f036eca
Reviewed-on: https://go-review.googlesource.com/37624
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
parent 6d32b1a3
......@@ -555,7 +555,8 @@ func TestClientRedirect308NoLocation(t *testing.T) {
w.WriteHeader(308)
}))
defer ts.Close()
res, err := Get(ts.URL)
c := &Client{Transport: &Transport{DisableKeepAlives: true}}
res, err := c.Get(ts.URL)
if err != nil {
t.Fatal(err)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment