Make TestTime_Elapsed less flaky
This test fails sometimes because the elapsed time is 1.999s which is less than 2s, but very close to 2s to not matter.pull/6430/head
parent
f679787080
commit
7aefe1e889
|
@ -54,7 +54,8 @@ func TestTimer_Elapsed(t *testing.T) {
|
|||
time.Sleep(2 * time.Second)
|
||||
tmr.StopTimer()
|
||||
e := tmr.Elapsed()
|
||||
if time.Duration(2*time.Second) > e || e > time.Duration(3*time.Second) {
|
||||
|
||||
if time.Duration(1990*time.Millisecond) > e || e > time.Duration(3*time.Second) {
|
||||
t.Errorf("expected around %s got %s", time.Duration(2*time.Second), e)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue