From c668715334facdaf713615ab5a1e35e94c81da89 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 18 Mar 2013 13:32:42 -0700 Subject: [PATCH] net/http: shorten and clean up TestTransportConcurrency R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7817044 --- src/pkg/net/http/transport_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pkg/net/http/transport_test.go b/src/pkg/net/http/transport_test.go index c361979bbb..4bb711b17f 100644 --- a/src/pkg/net/http/transport_test.go +++ b/src/pkg/net/http/transport_test.go @@ -941,14 +941,17 @@ func TestChunkedNoContent(t *testing.T) { func TestTransportConcurrency(t *testing.T) { defer afterTest(t) - const maxProcs = 16 - const numReqs = 500 + maxProcs, numReqs := 16, 500 + if testing.Short() { + maxProcs, numReqs = 4, 50 + } defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(maxProcs)) ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { fmt.Fprintf(w, "%v", r.FormValue("echo")) })) defer ts.Close() tr := &Transport{} + defer tr.CloseIdleConnections() c := &Client{Transport: tr} reqs := make(chan string) defer close(reqs) @@ -973,8 +976,8 @@ func TestTransportConcurrency(t *testing.T) { if string(all) != req { t.Errorf("body of req %s = %q; want %q", req, all, req) } - wg.Done() res.Body.Close() + wg.Done() } }() } -- 2.50.0