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
This commit is contained in:
Andrew Gerrand 2014-04-02 08:23:35 +11:00
parent 6c7cbf086c
commit 2f3776ac27
1 changed files with 2 additions and 3 deletions

View File

@ -347,19 +347,18 @@ func TestReset(t *testing.T) {
// Test that sleeping for an interval so large it overflows does not
// result in a short sleep duration.
func TestOverflowSleep(t *testing.T) {
const timeout = 25 * Millisecond
const big = Duration(int64(1<<63 - 1))
select {
case <-After(big):
t.Fatalf("big timeout fired")
case <-After(timeout):
case <-After(25 * Millisecond):
// OK
}
const neg = Duration(-1 << 63)
select {
case <-After(neg):
// OK
case <-After(timeout):
case <-After(1 * Second):
t.Fatalf("negative timeout didn't fire")
}
}