$ GOOS=js GOARCH=wasm go test -v
=== RUN TestTCPListenAfterClose
listener_test.go:51: after l.Close(), l.Accept() = _, <nil>
want use of closed network connection
--- FAIL: TestTCPListenAfterClose (0.01s)
As far as I can tell this violates the net.Listener interface, which requires (emphasis mine):
Close closes the listener.
Any blocked Accept operations will be unblocked and return errors.
In CL 372495 I cleaned up TestLimitListener so that it would not fail
spuriously. However, upon further thought I realized that the original
test was actually checking two different properties (steady-state
saturation, and actual overload), and the cleaned-up test was only
checking one of those (overload).
This change adds a separate test for steady-state saturation, and
makes the overload test more robust to spurious connections (which
could occur, for example, if another test running on the machine
accidentally dials this test's open port).
The test cleanup also revealed a bad interaction with an existing bug
in the js/wasm net.TCPListener implementation (filed as
golang/go#50216), for which I have added a workaround in
Trust: Bryan Mills <email@example.com>
Run-TryBot: Bryan Mills <firstname.lastname@example.org>
TryBot-Result: Gopher Robot <email@example.com>
Reviewed-by: Ian Lance Taylor <firstname.lastname@example.org>