From 7e5906a57d92e8afe8a6bb3f5d4c19d0e920ab9a Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Thu, 26 Jan 2023 13:16:26 -0800 Subject: [PATCH] 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 Run-TryBot: Damien Neil Reviewed-by: Bryan Mills --- src/net/http/transport_test.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go index 2879dee0fd..cb5af755db 100644 --- a/src/net/http/transport_test.go +++ b/src/net/http/transport_test.go @@ -3700,13 +3700,8 @@ func testTransportClosesBodyOnError(t *testing.T, mode testMode) { if err == nil || !strings.Contains(err.Error(), fakeErr.Error()) { t.Fatalf("Do error = %v; want something containing %q", err, fakeErr.Error()) } - select { - case err := <-readBody: - 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") + if err := <-readBody; err == nil { + t.Errorf("Unexpected success reading request body from handler; want 'unexpected EOF reading trailer'") } select { case <-didClose: