Commit 48858a23 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

net/http: deflake TestInterruptWithPanic_nil_h2, again

Updates #17243

Change-Id: Iaa737874e75fdac73452f1fc13a5749e8df78ebe
Reviewed-on: https://go-review.googlesource.com/33332
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 14e9f482
......@@ -1177,10 +1177,19 @@ func testInterruptWithPanic(t *testing.T, h2 bool, panicValue interface{}) {
const msg = "hello"
defer afterTest(t)
testDone := make(chan struct{})
defer close(testDone)
var errorLog lockedBytesBuffer
gotHeaders := make(chan bool, 1)
cst := newClientServerTest(t, h2, HandlerFunc(func(w ResponseWriter, r *Request) {
io.WriteString(w, msg)
w.(Flusher).Flush()
select {
case <-gotHeaders:
case <-testDone:
}
panic(panicValue)
}), func(ts *httptest.Server) {
ts.Config.ErrorLog = log.New(&errorLog, "", 0)
......@@ -1190,6 +1199,7 @@ func testInterruptWithPanic(t *testing.T, h2 bool, panicValue interface{}) {
if err != nil {
t.Fatal(err)
}
gotHeaders <- true
defer res.Body.Close()
slurp, err := ioutil.ReadAll(res.Body)
if string(slurp) != msg {
......
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