diff options
| author | Bryan C. Mills <bcmills@google.com> | 2021-11-29 15:17:36 -0500 |
|---|---|---|
| committer | Bryan C. Mills <bcmills@google.com> | 2021-11-30 03:39:57 +0000 |
| commit | 18934e11ba6ef2b2f21f091ddf4ab6814dcf1959 (patch) | |
| tree | 859ce0ed7e9d84a35ef315f445c4a9f1857b9671 /src/net/http | |
| parent | f463b20789c89f0d22e56663a34e57a942f945cf (diff) | |
| download | go-18934e11ba6ef2b2f21f091ddf4ab6814dcf1959.tar.xz | |
net/http: eliminate arbitrary timeout in TestClientWriteShutdown
This test occasionally hangs on the darwin-arm64-11_0-toothrot
builder. When it does, it fails with the unhelpful error message
"timeout" instead of a useful goroutine dump.
This change eliminates the use of an arbitrary timeout channel, so
that if (and probably when) the test hangs again we will get more
useful logs to diagnose the root cause.
For #49860
Change-Id: I23f6f1c81209f0b2dbe565e1dfb26b1b2eff0187
Reviewed-on: https://go-review.googlesource.com/c/go/+/367615
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/net/http')
| -rw-r--r-- | src/net/http/serve_test.go | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go index 1156b187ae..82c1a6716f 100644 --- a/src/net/http/serve_test.go +++ b/src/net/http/serve_test.go @@ -3075,22 +3075,14 @@ func TestClientWriteShutdown(t *testing.T) { if err != nil { t.Fatalf("CloseWrite: %v", err) } - donec := make(chan bool) - go func() { - defer close(donec) - bs, err := io.ReadAll(conn) - if err != nil { - t.Errorf("ReadAll: %v", err) - } - got := string(bs) - if got != "" { - t.Errorf("read %q from server; want nothing", got) - } - }() - select { - case <-donec: - case <-time.After(10 * time.Second): - t.Fatalf("timeout") + + bs, err := io.ReadAll(conn) + if err != nil { + t.Errorf("ReadAll: %v", err) + } + got := string(bs) + if got != "" { + t.Errorf("read %q from server; want nothing", got) } } |
