From 7e74d74c3a7edaae693f3e6722ef32adc57f7fb7 Mon Sep 17 00:00:00 2001 From: Deluan Date: Sun, 30 Nov 2025 21:58:45 -0500 Subject: [PATCH] test: remove racy buffer length assertion in scrobbler test Removed the buffer.Length() check that was causing intermittent test failures. The background goroutine started by newBufferedScrobbler can process and dequeue scrobble entries before the test assertion runs, leading to a race condition where the observed length is 0 instead of 1. The Eventually block that follows already verifies the scrobble was processed correctly. Signed-off-by: Deluan --- core/scrobbler/buffered_scrobbler_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/scrobbler/buffered_scrobbler_test.go b/core/scrobbler/buffered_scrobbler_test.go index c1440046d..063e0de8c 100644 --- a/core/scrobbler/buffered_scrobbler_test.go +++ b/core/scrobbler/buffered_scrobbler_test.go @@ -51,9 +51,10 @@ var _ = Describe("BufferedScrobbler", func() { Expect(scr.ScrobbleCalled.Load()).To(BeFalse()) Expect(bs.Scrobble(ctx, "user1", scrobble)).To(Succeed()) - Expect(buffer.Length()).To(Equal(int64(1))) - // Wait for the scrobble to be sent + // Wait for the background goroutine to process the scrobble. + // We don't check buffer.Length() here because the background goroutine + // may dequeue the entry before we can observe it. Eventually(scr.ScrobbleCalled.Load).Should(BeTrue()) lastScrobble := scr.LastScrobble.Load()