pkg/wait: fix TestWaitTestStress
The test may fail if two consequent time.Now() returns the same value. Sleep 1ns to avoid this situation.
This commit is contained in:
@ -53,6 +53,8 @@ func TestWaitTestStress(t *testing.T) {
|
|||||||
wt := NewTimeList()
|
wt := NewTimeList()
|
||||||
for i := 0; i < 10000; i++ {
|
for i := 0; i < 10000; i++ {
|
||||||
chs = append(chs, wt.Wait(time.Now()))
|
chs = append(chs, wt.Wait(time.Now()))
|
||||||
|
// sleep one nanosecond before waiting on the next event
|
||||||
|
time.Sleep(time.Nanosecond)
|
||||||
}
|
}
|
||||||
wt.Trigger(time.Now())
|
wt.Trigger(time.Now())
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user