diff options
| author | Damien Neil <dneil@google.com> | 2023-04-07 10:04:42 -0700 |
|---|---|---|
| committer | Damien Neil <dneil@google.com> | 2023-04-07 18:08:14 +0000 |
| commit | 1444c0b01e4f83a90f0d97b3bf0b346290ec02e3 (patch) | |
| tree | 061deec5888e005a3418755ca6baa2a738706012 /src/net/http/export_test.go | |
| parent | 38dadcc3b5e0f0ed70d224f1eb519a83dcdb52de (diff) | |
| download | go-1444c0b01e4f83a90f0d97b3bf0b346290ec02e3.tar.xz | |
net/http: wait forever for write results in tests
After performing a round trip on a connection, the connection is
usually returned to the idle connection pool. If the write of the
request did not complete successfully, the connection is not
returned.
It is possible for the response to be read before the write
goroutine has finished signalling that its write has completed.
To allow for this, the check to see if the write completed successfully
waits for 50ms for the write goroutine to report the result of the
write.
See comments in persistConn.wroteRequest for more details.
On a slow builder, it is possible for the write goroutine to take
longer than 50ms to report the status of its write, leading to test
flakiness when successive requests unexpectedly use different connections.
Set the timeout for waiting for the writer to an effectively
infinite duration in tests.
Fixes #51147
Fixes #56275
Fixes #56419
Fixes #56577
Fixes #57375
Fixes #57417
Fixes #57476
Fixes #57604
Fixes #57605
Change-Id: I5e92ffd66b676f3f976d8832c0910f27456a6991
Reviewed-on: https://go-review.googlesource.com/c/go/+/483116
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Diffstat (limited to 'src/net/http/export_test.go')
| -rw-r--r-- | src/net/http/export_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net/http/export_test.go b/src/net/http/export_test.go index 8a61e651dc..5d198f3f89 100644 --- a/src/net/http/export_test.go +++ b/src/net/http/export_test.go @@ -36,7 +36,7 @@ var ( Export_is408Message = is408Message ) -const MaxWriteWaitBeforeConnReuse = maxWriteWaitBeforeConnReuse +var MaxWriteWaitBeforeConnReuse = &maxWriteWaitBeforeConnReuse func init() { // We only want to pay for this cost during testing. |
