]> Cypherpunks.ru repositories - gostls13.git/commit
context: fix a flaky timeout in TestLayersTimeout
authorBryan C. Mills <bcmills@google.com>
Mon, 30 Mar 2020 18:04:08 +0000 (14:04 -0400)
committerBryan C. Mills <bcmills@google.com>
Tue, 31 Mar 2020 17:59:03 +0000 (17:59 +0000)
commit5d2ddcd3f51c1ff7aa0a84604b1d8610a17a7933
treeee5d94a3252af4b9503728f979a6d21dc9759627
parent5db079d2e5f97952be288c28a3a0690a523efdce
context: fix a flaky timeout in TestLayersTimeout

In CL 223019, I reduced the short timeout in the testLayers helper to
be even shorter than it was. That exposed a racy (time-dependent)
select later in the function, which failed in one of the slower
builders (android-386-emu).

Also streamline the test to make it easier to test with a very high -count flag:
- Run tests that sleep for shortDuration in parallel to reduce latency.
- Use shorter durations in examples to reduce test running time.
- Avoid mutating global state (in package math/rand) in testLayers.

After this change (but not before it),
'go test -run=TestLayersTimeout -count=100000 context' passes on my workstation.

Fixes #38161

Change-Id: Iaf4abe7ac308b2100d8828267cda9f4f8ae4be82
Reviewed-on: https://go-review.googlesource.com/c/go/+/226457
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/context/context_test.go
src/context/example_test.go