Commit 9578839d authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

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
parent 47afa4db
...@@ -398,11 +398,15 @@ func TestLinuxSendfile(t *testing.T) { ...@@ -398,11 +398,15 @@ func TestLinuxSendfile(t *testing.T) {
return return
} }
_, err = Get(fmt.Sprintf("http://%s/", ln.Addr())) res, err := Get(fmt.Sprintf("http://%s/", ln.Addr()))
if err != nil { if err != nil {
t.Errorf("http client error: %v", err) t.Fatalf("http client error: %v", err)
return }
_, 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. // Force child to exit cleanly.
Get(fmt.Sprintf("http://%s/quit", ln.Addr())) Get(fmt.Sprintf("http://%s/quit", ln.Addr()))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment