test(scanner): run multi-library and selective scan specs on Windows (#5381) (#6307)

* test(scanner): run multi-library and selective scan specs on Windows

Both suites put their DB in Ginkgo's TempDir, but the shared db.Db() pool stays open until TestScanner returns, so on Windows the TempDir cleanup failed with a sharing violation. Use the same os.MkdirTemp plus best-effort RemoveAll setup as scanner_test.go and drop the skips.

Signed-off-by: junkerderprovinz <jdp@braethoria.com>

* test(scanner): say why the DB may stay open in the temp dir

Signed-off-by: junkerderprovinz <jdp@braethoria.com>

---------

Signed-off-by: junkerderprovinz <jdp@braethoria.com>
Co-authored-by: junkerderprovinz <jdp@braethoria.com>
Co-authored-by: Deluan Quintão <deluan@navidrome.org>
This commit is contained in:
Junker der Provinz 2026-11-14 04:58:10 +01:00 committed by GitHub
parent 88adc02f74
commit 2ce7ef53ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View File

@ -3,6 +3,7 @@ package scanner_test
import (
"context"
"errors"
"os"
"path/filepath"
"testing/fstest"
"time"
@ -41,9 +42,12 @@ var _ = Describe("Scanner - Multi-Library", Ordered, func() {
}
BeforeAll(func() {
tests.SkipOnWindows("SQLite file lock blocks TempDir cleanup (#TBD-path-sep-scanner)")
ctx = request.WithUser(GinkgoT().Context(), model.User{ID: "123", IsAdmin: true})
tmpDir := GinkgoT().TempDir()
// db.Db() is a process-wide singleton, so this dir may hold the open DB until
// the suite ends, and Windows can't delete an open file
tmpDir, err := os.MkdirTemp("", "scanner-test")
Expect(err).ToNot(HaveOccurred())
DeferCleanup(func() { _ = os.RemoveAll(tmpDir) })
DeferCleanup(conf.SnapshotConfig())
conf.Update(func(c *conf.Options) {
c.DbPath = filepath.Join(tmpDir, "test-scanner-multilibrary.db?_journal_mode=WAL")

View File

@ -2,6 +2,7 @@ package scanner_test
import (
"context"
"os"
"path/filepath"
"testing/fstest"
"time"
@ -34,9 +35,12 @@ var _ = Describe("ScanFolders", Ordered, func() {
var fsys storagetest.FakeFS
BeforeAll(func() {
tests.SkipOnWindows("SQLite file lock blocks TempDir cleanup (#TBD-path-sep-scanner)")
ctx = request.WithUser(GinkgoT().Context(), model.User{ID: "123", IsAdmin: true})
tmpDir := GinkgoT().TempDir()
// db.Db() is a process-wide singleton, so this dir may hold the open DB until
// the suite ends, and Windows can't delete an open file
tmpDir, err := os.MkdirTemp("", "scanner-test")
Expect(err).ToNot(HaveOccurred())
DeferCleanup(func() { _ = os.RemoveAll(tmpDir) })
DeferCleanup(conf.SnapshotConfig())
conf.Update(func(c *conf.Options) { c.DbPath = filepath.Join(tmpDir, "test-selective-scan.db?_journal_mode=WAL") })
log.Warn("Using DB at " + conf.Server().DbPath)