]> Cypherpunks repositories - gostls13.git/commit
context: deflake time-sensitive tests
authorBryan C. Mills <bcmills@google.com>
Wed, 11 Mar 2020 19:14:38 +0000 (15:14 -0400)
committerBryan C. Mills <bcmills@google.com>
Fri, 13 Mar 2020 22:25:52 +0000 (22:25 +0000)
commite8ecda8a38a1705d2ead985743f287acad34b542
tree1ce58c92da92e35493491ecab2c881be8e9c6278
parentb851e51160bc8ed412e229152b430b75e7ce56f9
context: deflake time-sensitive tests

Many of tests in this package assumed reasonable scheduling latency.
Unfortunately, scheduling latency on builders and CI systems is not
always reasonable.

Rather than expecting that a timeout is detected within a fixed short
interval, we can use (*testing.T).Deadline to portably scale the time
we're willing to wait to something appropriate to the builder.

Some of the tests also included arbitrary-duration sleeps, which are
no longer needed after CL 196521; we can remove those instead of
extending them.

Promptness of timeouts is also an important property, but testing that
property is better suited to benchmarks than to tests proper: unlike
tests, we generally expect benchmarks to be run in a quiet,
low-contention environment.

Fixes #13956

Change-Id: I0797e2267fb778c8ad94add56d797de9e2c885e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/223019
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/context/context_test.go