1
0
mirror of https://github.com/golang/go synced 2024-11-08 18:26:14 -07:00

net/http: deflake TestServerEmptyBodyRace_h1, or at least try

Fixes #22540.
For #33585.

Change-Id: I504b5a91ce1a39cd4ffd2380178a1b8f82f49dd3
Reviewed-on: https://go-review.googlesource.com/c/go/+/261698
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
Russ Cox 2020-10-12 21:09:18 -04:00
parent 7602d41196
commit 59202c4204

View File

@ -4275,8 +4275,14 @@ func testServerEmptyBodyRace(t *testing.T, h2 bool) {
defer wg.Done() defer wg.Done()
res, err := cst.c.Get(cst.ts.URL) res, err := cst.c.Get(cst.ts.URL)
if err != nil { if err != nil {
t.Error(err) // Try to deflake spurious "connection reset by peer" under load.
return // See golang.org/issue/22540.
time.Sleep(10 * time.Millisecond)
res, err = cst.c.Get(cst.ts.URL)
if err != nil {
t.Error(err)
return
}
} }
defer res.Body.Close() defer res.Body.Close()
_, err = io.Copy(ioutil.Discard, res.Body) _, err = io.Copy(ioutil.Discard, res.Body)