mirror of
https://github.com/navidrome/navidrome.git
synced 2025-12-23 15:08:04 -05:00
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 <deluan@navidrome.org>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user