]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: fix flaky TestClientRedirect308NoLocation
authorBrad Fitzpatrick <bradfitz@golang.org>
Wed, 1 Mar 2017 05:42:32 +0000 (05:42 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 1 Mar 2017 15:04:23 +0000 (15:04 +0000)
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: Josh Bleecher Snyder <josharian@gmail.com>
src/net/http/client_test.go

index 4f674dd8d6c785ca45b06781f2b2a247344db6ce..105b310c6a505a21ae6e060aaa4a12f2c565168a 100644 (file)
@@ -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)
        }