audio: bug fix: reduce test flakiness

This commit is contained in:
Hajime Hoshi 2024-07-14 19:31:47 +09:00
parent 1d75c9e967
commit 09cac12390

View File

@ -16,6 +16,7 @@ package audio_test
import (
"bytes"
"os"
"runtime"
"testing"
"time"
@ -34,6 +35,14 @@ func teardown() {
context = nil
}
func TestMain(m *testing.M) {
code := m.Run()
// 200[ms] should be enough all the players are consumed.
// TODO: This is a dirty hack. Would it be possible to use virtual time?
time.Sleep(200 * time.Millisecond)
os.Exit(code)
}
// Issue #746
func TestGC(t *testing.T) {
setup()
@ -138,8 +147,4 @@ func TestNonSeekableSource(t *testing.T) {
p.Play()
p.Pause()
// 200[ms] should be enough all the bytes are consumed.
// TODO: This is a dirty hack. Would it be possible to use virtual time?
time.Sleep(200 * time.Millisecond)
}