diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2013-03-18 13:32:42 -0700 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2013-03-18 13:32:42 -0700 |
| commit | c668715334facdaf713615ab5a1e35e94c81da89 (patch) | |
| tree | 64cbb6550b2ca32634fe0865248ebe9600be4fea /src | |
| parent | ba50e4f1203ad5cc20b7ada2fce4da62ab195622 (diff) | |
| download | go-c668715334facdaf713615ab5a1e35e94c81da89.tar.xz | |
net/http: shorten and clean up TestTransportConcurrency
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7817044
Diffstat (limited to 'src')
| -rw-r--r-- | src/pkg/net/http/transport_test.go | 9 |
1 files 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() } }() } |
