mirror of
https://github.com/golang/go
synced 2024-11-25 00:07:56 -07:00
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
This commit is contained in:
parent
47afa4dba5
commit
9578839d60
@ -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()))
|
||||
|
Loading…
Reference in New Issue
Block a user