diff --git a/scanner/scanner_multilibrary_test.go b/scanner/scanner_multilibrary_test.go index 488608b98..87782b4a0 100644 --- a/scanner/scanner_multilibrary_test.go +++ b/scanner/scanner_multilibrary_test.go @@ -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") diff --git a/scanner/scanner_selective_test.go b/scanner/scanner_selective_test.go index f462037ca..a9c30260e 100644 --- a/scanner/scanner_selective_test.go +++ b/scanner/scanner_selective_test.go @@ -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)