From 3a1eeabff19e1068da6c312f0ac7f556841f872e Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 1 Feb 2025 14:10:37 +0900 Subject: [PATCH] audio: fix test flakiness This test could fail on Windows, though this is pretty rare. https://github.com/hajimehoshi/ebiten/actions/runs/13085345903/job/36515771792 ``` === RUN TestSameSourcePlayers audio_test.go:98: got: nil, want: an error ``` --- audio/audio_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/audio/audio_test.go b/audio/audio_test.go index a238feadc..8125c3ff5 100644 --- a/audio/audio_test.go +++ b/audio/audio_test.go @@ -94,9 +94,14 @@ func TestSameSourcePlayers(t *testing.T) { p0.Play() p1.Play() - if err := audio.UpdateForTesting(); err == nil { - t.Errorf("got: nil, want: an error") + for i := 0; i < 10; i++ { + if err := audio.UpdateForTesting(); err != nil { + // An error is expected. + return + } + time.Sleep(200 * time.Millisecond) } + t.Errorf("time out") } func TestPauseBeforeInit(t *testing.T) {