From 501ddf7189cf97ef27eb870ad134a312f80ae585 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 11 Apr 2016 18:16:55 +0000 Subject: context: attempt to deflake timing tests Passes on OpenBSD now when running it with -count=500. Presumably this will also fix the same problems seen on FreeBSD and Windows. Fixes #15158 Change-Id: I86451c901613dfa5ecff0c2ecc516527a3c011b3 Reviewed-on: https://go-review.googlesource.com/21840 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Andrew Gerrand --- src/context/withtimeout_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/context/withtimeout_test.go') diff --git a/src/context/withtimeout_test.go b/src/context/withtimeout_test.go index 3ab6fc347f..2aea303bed 100644 --- a/src/context/withtimeout_test.go +++ b/src/context/withtimeout_test.go @@ -13,9 +13,9 @@ import ( func ExampleWithTimeout() { // Pass a context with a timeout to tell a blocking function that it // should abandon its work after the timeout elapses. - ctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond) + ctx, _ := context.WithTimeout(context.Background(), 50*time.Millisecond) select { - case <-time.After(200 * time.Millisecond): + case <-time.After(1 * time.Second): fmt.Println("overslept") case <-ctx.Done(): fmt.Println(ctx.Err()) // prints "context deadline exceeded" -- cgit v1.3