tests: de-flake goroutines test

This commit is contained in:
Elias Naur
2025-07-17 12:58:43 +02:00
committed by Ron Evans
parent 435ddc5f2d
commit 1b5d312c68
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -175,10 +175,13 @@ func testGoOnBuiltins() {
var once sync.Once
var waitChan = make(chan struct{})
func testGoOnInterface(f Itf) {
go f.Nowait()
time.Sleep(time.Millisecond)
go f.Wait()
<-waitChan
time.Sleep(time.Millisecond * 2)
println("done with 'go on interface'")
}
@@ -204,6 +207,7 @@ func (f Foo) Nowait() {
func (f Foo) Wait() {
println("called: Foo.Wait")
close(waitChan)
time.Sleep(time.Microsecond)
println(" ...waited")
}