mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-08 02:17:25 +02:00
test(scanner): fix Windows flake in the quick-scan artist image spec (#6093)
The spec asserted on artistID("Kraftwerk") and intermittently found zero artists
on Windows. The scan did import the artist; it was then made invisible.
RefreshStats selects touched artists with a strict artist.updated_at >
library.last_scan_at (persistence/artist_repository.go:466). Windows' wall clock
has ~15ms granularity, so a new artist written by a quick scan can land in the
same tick as the previous scan's last_scan_at and be excluded. Its
library_artist.stats then stays at the '{}' default and the unscoped cleanup
DELETE removes the row, after which selectArtist's INNER JOIN on library_artist
hides the artist from GetAll.
Backdate last_scan_at before the scan so the comparison is unambiguous, matching
the fix already applied to the search_normalized spec below it.
This commit is contained in:
parent
8a2135f076
commit
9198bde34a
1 changed files with 5 additions and 0 deletions
|
|
@ -387,6 +387,11 @@ var _ = Describe("Scanner", Ordered, func() {
|
|||
files := fsys.MapFS
|
||||
files["Kraftwerk/Autobahn/01 - Autobahn.mp3"] = kraftwerk(track(1, "Autobahn"))
|
||||
fsys.SetFiles(files)
|
||||
// Backdate the previous scan so this one's new artists are unambiguously newer:
|
||||
// RefreshStats picks touched artists with a strict artist.updated_at >
|
||||
// library.last_scan_at, and Windows' coarse clock can put both in one tick.
|
||||
_, err := db.Db().ExecContext(ctx, "UPDATE library SET last_scan_at = ?", time.Now().Add(-time.Hour))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(runScanner(ctx, false)).To(Succeed())
|
||||
resolveQueuedArtwork()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue