stabilize flaky utils_test
This commit is contained in:
parent
922977e846
commit
80e9d4410e
|
@ -34,12 +34,13 @@ func TestEveryWhenStopped(t *testing.T) {
|
||||||
select {
|
select {
|
||||||
case <-sem:
|
case <-sem:
|
||||||
done.Stop()
|
done.Stop()
|
||||||
case <-time.After(120 * time.Millisecond):
|
case <-time.After(190 * time.Millisecond):
|
||||||
|
done.Stop()
|
||||||
t.Errorf("Every was not called")
|
t.Errorf("Every was not called")
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-time.After(120 * time.Millisecond):
|
case <-time.After(190 * time.Millisecond):
|
||||||
case <-sem:
|
case <-sem:
|
||||||
t.Error("Every should have stopped")
|
t.Error("Every should have stopped")
|
||||||
}
|
}
|
||||||
|
@ -49,14 +50,14 @@ func TestAfter(t *testing.T) {
|
||||||
i := 0
|
i := 0
|
||||||
sem := make(chan bool)
|
sem := make(chan bool)
|
||||||
|
|
||||||
After(10*time.Millisecond, func() {
|
After(100*time.Millisecond, func() {
|
||||||
i++
|
i++
|
||||||
sem <- true
|
sem <- true
|
||||||
})
|
})
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-sem:
|
case <-sem:
|
||||||
case <-time.After(30 * time.Millisecond):
|
case <-time.After(190 * time.Millisecond):
|
||||||
t.Errorf("After was not called")
|
t.Errorf("After was not called")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue