diff options
| author | Russ Cox <rsc@golang.org> | 2020-10-12 11:56:15 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2020-10-12 17:22:19 +0000 |
| commit | 373695727b8975d20168ca0d6ae338f98a4a079a (patch) | |
| tree | a663200e51ba8df3be6d9f4644981584a4f7c49e /src/net | |
| parent | 9e2acf94fe1baa8bdffb21c2d54e0186ac88b68b (diff) | |
| download | go-git-373695727b8975d20168ca0d6ae338f98a4a079a.tar.gz | |
net/http: deflake TestTransportPersistConnLeak on macOS
On a loaded system, sometimes connections don't work out.
Ignore those in TestTransportPersistConnLeak to avoid flakes.
For #33585.
Change-Id: Ic07057532dc0ea5115d6ec49c3c29099a9382295
Reviewed-on: https://go-review.googlesource.com/c/go/+/261538
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/http/transport_test.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go index a1c9e822b4..b152007282 100644 --- a/src/net/http/transport_test.go +++ b/src/net/http/transport_test.go @@ -1701,7 +1701,7 @@ func TestTransportPersistConnLeak(t *testing.T) { res, err := c.Get(ts.URL) didReqCh <- true if err != nil { - t.Errorf("client fetch error: %v", err) + t.Logf("client fetch error: %v", err) failed <- true return } @@ -1715,17 +1715,15 @@ func TestTransportPersistConnLeak(t *testing.T) { case <-gotReqCh: // ok case <-failed: - close(unblockCh) - return + // Not great but not what we are testing: + // sometimes an overloaded system will fail to make all the connections. } } nhigh := runtime.NumGoroutine() // Tell all handlers to unblock and reply. - for i := 0; i < numReq; i++ { - unblockCh <- true - } + close(unblockCh) // Wait for all HTTP clients to be done. for i := 0; i < numReq; i++ { |
