Commit 2f3776ac authored by Andrew Gerrand's avatar Andrew Gerrand

time: increase timeout in negative sleep duration test

There's enough jitter in the scheduler on overloaded machines
that 25ms is not enough.

LGTM=dave
R=golang-codereviews, gobot, rsc, dave
CC=golang-codereviews
https://golang.org/cl/83300044
parent 6c7cbf08
...@@ -347,19 +347,18 @@ func TestReset(t *testing.T) { ...@@ -347,19 +347,18 @@ func TestReset(t *testing.T) {
// Test that sleeping for an interval so large it overflows does not // Test that sleeping for an interval so large it overflows does not
// result in a short sleep duration. // result in a short sleep duration.
func TestOverflowSleep(t *testing.T) { func TestOverflowSleep(t *testing.T) {
const timeout = 25 * Millisecond
const big = Duration(int64(1<<63 - 1)) const big = Duration(int64(1<<63 - 1))
select { select {
case <-After(big): case <-After(big):
t.Fatalf("big timeout fired") t.Fatalf("big timeout fired")
case <-After(timeout): case <-After(25 * Millisecond):
// OK // OK
} }
const neg = Duration(-1 << 63) const neg = Duration(-1 << 63)
select { select {
case <-After(neg): case <-After(neg):
// OK // OK
case <-After(timeout): case <-After(1 * Second):
t.Fatalf("negative timeout didn't fire") t.Fatalf("negative timeout didn't fire")
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment