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

net/http: remove five second timeout from TestTransportClosesBodyOnError

Wait forever and let the test time out with a stack trace if the
expected response doesn't happen.

Fixes #57990

Change-Id: I835def63db113752cdd06e03e258cb10d63a6a25
Reviewed-on: https://go-review.googlesource.com/c/go/+/463222
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
This commit is contained in:
Damien Neil 2023-01-26 13:16:26 -08:00
parent d49719b1f7
commit 7e5906a57d

View File

@ -3700,13 +3700,8 @@ func testTransportClosesBodyOnError(t *testing.T, mode testMode) {
if err == nil || !strings.Contains(err.Error(), fakeErr.Error()) { if err == nil || !strings.Contains(err.Error(), fakeErr.Error()) {
t.Fatalf("Do error = %v; want something containing %q", err, fakeErr.Error()) t.Fatalf("Do error = %v; want something containing %q", err, fakeErr.Error())
} }
select { if err := <-readBody; err == nil {
case err := <-readBody: t.Errorf("Unexpected success reading request body from handler; want 'unexpected EOF reading trailer'")
if err == nil {
t.Errorf("Unexpected success reading request body from handler; want 'unexpected EOF reading trailer'")
}
case <-time.After(5 * time.Second):
t.Error("timeout waiting for server handler to complete")
} }
select { select {
case <-didClose: case <-didClose: