mirror of
https://github.com/golang/go
synced 2024-11-12 02:10:21 -07:00
net/http/httputil: don't use testing.T after test completes
This fixes a race condition where TestReverseProxyWebSocketCancelation appears to panic after otherwise passing. Fixes #38863 Change-Id: Ib89f4c40da879b92ac1fc5ed8b6e48da929e4a18 Reviewed-on: https://go-review.googlesource.com/c/go/+/232257 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
01a9cf8487
commit
b40c658063
@ -1224,13 +1224,22 @@ func TestReverseProxyWebSocketCancelation(t *testing.T) {
|
||||
|
||||
for i := 0; i < n; i++ {
|
||||
if _, err := bufrw.WriteString(nthResponse(i)); err != nil {
|
||||
t.Errorf("Writing response #%d failed: %v", i, err)
|
||||
select {
|
||||
case <-triggerCancelCh:
|
||||
default:
|
||||
t.Errorf("Writing response #%d failed: %v", i, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
bufrw.Flush()
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
if _, err := bufrw.WriteString(terminalMsg); err != nil {
|
||||
t.Errorf("Failed to write terminal message: %v", err)
|
||||
select {
|
||||
case <-triggerCancelCh:
|
||||
default:
|
||||
t.Errorf("Failed to write terminal message: %v", err)
|
||||
}
|
||||
}
|
||||
bufrw.Flush()
|
||||
}))
|
||||
|
Loading…
Reference in New Issue
Block a user