aboutsummaryrefslogtreecommitdiff
path: root/src/encoding
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2015-07-26 16:03:13 -0400
committerAustin Clements <austin@google.com>2015-07-26 20:35:09 +0000
commite3ba0977beacc018fe9136284507298ce2d5e829 (patch)
treebf21926f049e6bbe4a183dd711435d784db8428f /src/encoding
parent9b7e728ee8ddacad70cbf5bced36c8f72af65f38 (diff)
downloadgo-e3ba0977beacc018fe9136284507298ce2d5e829.tar.xz
internal/singleflight: deflake TestDoDupSuppress
Currently TestDoDupSuppress can fail if the goroutines created by its loop run sequentially. This is rare, but it has caused failures on the dashboard and in stress testing. While I think there's no way to eliminate all possible thread schedules that could make this test fail because it depends on waiting until a Group.Do blocks, it is possible to make it much more robust. This commit deflakes this test by forcing at least one invocation of fn to start and all goroutines to reach the line just before the Do call before allowing fn to proceed. fn then waits 10 milliseconds before returning to allow the goroutines to pass through the Do. With this change, in 50,000 runs of the stress testing configuration, the number of calls to fn never even exceeded 1. Fixes #11784. Change-Id: Ie5adf5764545050ec407619769a656251c4cff04 Reviewed-on: https://go-review.googlesource.com/12681 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/encoding')
0 files changed, 0 insertions, 0 deletions