]> Cypherpunks repositories - gostls13.git/commit
net/http: buffer the testConn close channel in TestHandlerFinishSkipBigContentLengthRead
authorBryan C. Mills <bcmills@google.com>
Tue, 19 Sep 2023 14:37:28 +0000 (10:37 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 19 Sep 2023 16:22:19 +0000 (16:22 +0000)
commit3c4f12a7d6bc6839b3dd2f4b04aeca962745afb3
tree0d788414a2fa2dfe73325393de33775a2989a573
parent203c69a6ef7325f254c6f17dea26a72fdf40153b
net/http: buffer the testConn close channel in TestHandlerFinishSkipBigContentLengthRead

Previously the test used an unbuffered channel, but testConn.Close
sends to it with a select-with-default, so the send would be dropped
if the test goroutine happened not to have parked on the receive yet.

To make this kind of bug less likely in future tests, use a
newTestConn helper function instead of constructing testConn channel
literals in each test individually.

Fixes #62622.

Change-Id: I016cd0a89cf8a2a748ed57a4cdbd01a178f04dab
Reviewed-on: https://go-review.googlesource.com/c/go/+/529475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
src/net/http/serve_test.go