From b4bc7b44ae58b5679135b66ae058544afea6c81b Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 6 May 2015 10:54:20 -0700 Subject: [PATCH] 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 --- src/time/sleep_test.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/time/sleep_test.go b/src/time/sleep_test.go index 2fce753435..dd0a820dd6 100644 --- a/src/time/sleep_test.go +++ b/src/time/sleep_test.go @@ -223,13 +223,10 @@ func TestAfterStop(t *testing.T) { func TestAfterQueuing(t *testing.T) { // This test flakes out on some systems, // so we'll try it a few times before declaring it a failure. - const attempts = 3 + const attempts = 5 err := errors.New("!=nil") for i := 0; i < attempts && err != nil; i++ { - delta := 100 * Millisecond - if i == 0 && testing.Short() { - delta = 20 * Millisecond - } + delta := Duration(20+i*50) * Millisecond if err = testAfterQueuing(t, delta); err != nil { t.Logf("attempt %v failed: %v", i, err) }