1
0
mirror of https://github.com/golang/go synced 2024-11-14 18:50:31 -07:00
go/src/context
Bryan C. Mills 5d2ddcd3f5 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>
2020-03-31 17:59:03 +00:00
..
benchmark_test.go
context_test.go context: fix a flaky timeout in TestLayersTimeout 2020-03-31 17:59:03 +00:00
context.go context: prevent creation of invalid contexts 2020-03-18 19:44:13 +00:00
example_test.go context: fix a flaky timeout in TestLayersTimeout 2020-03-31 17:59:03 +00:00
net_test.go
x_test.go context: prevent creation of invalid contexts 2020-03-18 19:44:13 +00:00