From: Brad Fitzpatrick Date: Wed, 15 Feb 2012 22:27:26 +0000 (+1100) Subject: net/http: fix race in sendfile test X-Git-Tag: weekly.2012-02-22~218 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9578839d60fb0d49130d6689091573aa390f85a0;p=gostls13.git net/http: fix race in sendfile test Whoops. Consume the body of the first request before making the subsequent /quit request. R=golang-dev, untheoretic CC=golang-dev https://golang.org/cl/5674054 --- diff --git a/src/pkg/net/http/fs_test.go b/src/pkg/net/http/fs_test.go index 143617e95f..f3e4a053e3 100644 --- a/src/pkg/net/http/fs_test.go +++ b/src/pkg/net/http/fs_test.go @@ -398,11 +398,15 @@ func TestLinuxSendfile(t *testing.T) { return } - _, err = Get(fmt.Sprintf("http://%s/", ln.Addr())) + res, err := Get(fmt.Sprintf("http://%s/", ln.Addr())) if err != nil { - t.Errorf("http client error: %v", err) - return + t.Fatalf("http client error: %v", err) + } + _, err = io.Copy(ioutil.Discard, res.Body) + if err != nil { + t.Fatalf("client body read error: %v", err) } + res.Body.Close() // Force child to exit cleanly. Get(fmt.Sprintf("http://%s/quit", ln.Addr()))