Skip to content

Commit 51d58cb

Browse files
committed
Avoid sleep(0) for windows tests
1 parent 967ce7e commit 51d58cb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/gcc/overuse_detector_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package gcc
55

66
import (
7+
"runtime"
78
"testing"
89
"time"
910

@@ -99,7 +100,12 @@ func TestOveruseDetectorWithoutDelay(t *testing.T) {
99100
defer close(out)
100101
for _, e := range tc.estimates {
101102
od.onDelayStats(e)
102-
time.Sleep(tc.delay)
103+
if tc.delay == 0 {
104+
// avoid time.Sleep(0) since it's broken on windows.
105+
runtime.Gosched()
106+
} else {
107+
time.Sleep(tc.delay)
108+
}
103109
}
104110
}()
105111
received := []usage{}

0 commit comments

Comments
 (0)