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 ( import (
"bytes" "bytes"
"os"
"runtime" "runtime"
"testing" "testing"
"time" "time"
@ -34,6 +35,14 @@ func teardown() {
context = nil 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 // Issue #746
func TestGC(t *testing.T) { func TestGC(t *testing.T) {
setup() setup()
@ -138,8 +147,4 @@ func TestNonSeekableSource(t *testing.T) {
p.Play() p.Play()
p.Pause() 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)
} }