mirror of
https://github.com/navidrome/navidrome.git
synced 2025-12-23 23:18:05 -05:00
test: fix flaky CacheWarmer deduplication test
Fixed race condition in the 'deduplicates items in buffer' test where the background worker goroutine could process and clear the buffer before the test could verify its contents. Added fc.SetReady(false) to keep the cache unavailable during the test, ensuring buffered items remain in memory for verification. This matches the pattern already used in the 'adds multiple items to buffer' test. Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
@@ -90,6 +90,7 @@ var _ = Describe("CacheWarmer", func() {
|
||||
})
|
||||
|
||||
It("deduplicates items in buffer", func() {
|
||||
fc.SetReady(false) // Make cache unavailable so items stay in buffer
|
||||
cw := NewCacheWarmer(aw, fc).(*cacheWarmer)
|
||||
cw.PreCache(model.MustParseArtworkID("al-1"))
|
||||
cw.PreCache(model.MustParseArtworkID("al-1"))
|
||||
|
||||
Reference in New Issue
Block a user