1
0
mirror of https://github.com/golang/go synced 2024-11-05 11:46:12 -07:00

time: deflake TestAfterQueuing

Ramp up the delay on subsequent attempts. Fast builders have the same delay.

Not a perfect fix, but should make it better. And this easy.

Fixes #9903 maybe
Fixes #10680 maybe

Change-Id: I967380c2cb8196e6da9a71116961229d37b36335
Reviewed-on: https://go-review.googlesource.com/9795
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Brad Fitzpatrick 2015-05-06 10:54:20 -07:00
parent ec87dbf913
commit b4bc7b44ae

View File

@ -223,13 +223,10 @@ func TestAfterStop(t *testing.T) {
func TestAfterQueuing(t *testing.T) { func TestAfterQueuing(t *testing.T) {
// This test flakes out on some systems, // This test flakes out on some systems,
// so we'll try it a few times before declaring it a failure. // so we'll try it a few times before declaring it a failure.
const attempts = 3 const attempts = 5
err := errors.New("!=nil") err := errors.New("!=nil")
for i := 0; i < attempts && err != nil; i++ { for i := 0; i < attempts && err != nil; i++ {
delta := 100 * Millisecond delta := Duration(20+i*50) * Millisecond
if i == 0 && testing.Short() {
delta = 20 * Millisecond
}
if err = testAfterQueuing(t, delta); err != nil { if err = testAfterQueuing(t, delta); err != nil {
t.Logf("attempt %v failed: %v", i, err) t.Logf("attempt %v failed: %v", i, err)
} }