mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-19 15:23:36 +00:00
* 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:
parent
88adc02f74
commit
2ce7ef53ca
@ -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")
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user