🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
test(scanner): fix flaky Windows search_normalized rescan test (#5758)
Deluan Quintão116a4407184b
diff --git a/scanner/scanner_test.go b/scanner/scanner_test.goindex 7f3dca775..cc3720717 100644--- a/scanner/scanner_test.go+++ b/scanner/scanner_test.go@@ -6,6 +6,7 @@ import ("errors""path/filepath""testing/fstest"+ "time""github.com/Masterminds/squirrel""github.com/google/uuid"@@ -212,6 +213,15 @@ var _ = Describe("Scanner", Ordered, func() {_, err := db.Db().ExecContext(ctx, "UPDATE artist SET search_normalized = '' WHERE name = 'GØGGS'")Expect(err).ToNot(HaveOccurred())+ // Backdate the folder so the next full scan reliably sees it as outdated.+ // isOutdated() compares folder.updated_at (written by this scan) against the+ // next scan's last_scan_started_at with a strict Before(); back-to-back scans+ // can capture both within one clock tick on Windows (coarse wall-clock), making+ // the refresh flaky. Backdating forces the comparison to be unambiguous.+ _, err = db.Db().ExecContext(ctx,+ "UPDATE folder SET updated_at = ?", time.Now().Add(-time.Hour))+ Expect(err).ToNot(HaveOccurred())+Expect(runScanner(ctx, true)).To(Succeed())Expect(searchNormalized()).To(Equal("GOGGS"))})