mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
Remove temp folders after tests
This commit is contained in:
parent
fa3471f527
commit
66a9cbb7d9
6 changed files with 30 additions and 15 deletions
|
@ -39,6 +39,9 @@ var _ = Describe("Artwork", func() {
|
|||
Eventually(func() bool { return cache.Ready(context.TODO()) }).Should(BeTrue())
|
||||
artwork = NewArtwork(ds, cache)
|
||||
})
|
||||
AfterEach(func() {
|
||||
_ = os.RemoveAll(conf.Server.DataFolder)
|
||||
})
|
||||
|
||||
It("retrieves the external artwork art for an album", func() {
|
||||
r, err := artwork.Get(ctx, "al-444", 0)
|
||||
|
|
|
@ -32,6 +32,9 @@ var _ = Describe("MediaStreamer", func() {
|
|||
Eventually(func() bool { return testCache.Ready(context.TODO()) }).Should(BeTrue())
|
||||
streamer = NewMediaStreamer(ds, ffmpeg, testCache)
|
||||
})
|
||||
AfterEach(func() {
|
||||
_ = os.RemoveAll(conf.Server.DataFolder)
|
||||
})
|
||||
|
||||
Context("NewStream", func() {
|
||||
It("returns a seekable stream if format is 'raw'", func() {
|
||||
|
|
|
@ -88,19 +88,25 @@ var _ = Describe("AlbumRepository", func() {
|
|||
})
|
||||
|
||||
Describe("getCoverFromPath", func() {
|
||||
testFolder, _ := os.MkdirTemp("", "album_persistence_tests")
|
||||
if err := os.MkdirAll(testFolder, 0777); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if _, err := os.Create(filepath.Join(testFolder, "Cover.jpeg")); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if _, err := os.Create(filepath.Join(testFolder, "FRONT.PNG")); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
var testFolder, testPath, embeddedPath string
|
||||
BeforeEach(func() {
|
||||
testFolder, _ = os.MkdirTemp("", "album_persistence_tests")
|
||||
if err := os.MkdirAll(testFolder, 0777); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if _, err := os.Create(filepath.Join(testFolder, "Cover.jpeg")); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if _, err := os.Create(filepath.Join(testFolder, "FRONT.PNG")); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
testPath = filepath.Join(testFolder, "somefile.test")
|
||||
embeddedPath = filepath.Join(testFolder, "somefile.mp3")
|
||||
})
|
||||
AfterEach(func() {
|
||||
_ = os.RemoveAll(testFolder)
|
||||
})
|
||||
|
||||
testPath := filepath.Join(testFolder, "somefile.test")
|
||||
embeddedPath := filepath.Join(testFolder, "somefile.mp3")
|
||||
It("returns audio file for embedded cover", func() {
|
||||
conf.Server.CoverArtPriority = "embedded, cover.*, front.*"
|
||||
Expect(getCoverFromPath(testPath, embeddedPath)).To(Equal(""))
|
||||
|
|
2
utils/cache/file_caches_test.go
vendored
2
utils/cache/file_caches_test.go
vendored
|
@ -24,7 +24,7 @@ var _ = Describe("File Caches", func() {
|
|||
conf.Server.DataFolder, _ = os.MkdirTemp("", "file_caches")
|
||||
})
|
||||
AfterEach(func() {
|
||||
os.RemoveAll(conf.Server.DataFolder)
|
||||
_ = os.RemoveAll(conf.Server.DataFolder)
|
||||
})
|
||||
|
||||
Describe("NewFileCache", func() {
|
||||
|
|
3
utils/cache/spread_fs_test.go
vendored
3
utils/cache/spread_fs_test.go
vendored
|
@ -19,9 +19,8 @@ var _ = Describe("Spread FS", func() {
|
|||
fs, err = NewSpreadFS(rootDir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
Expect(os.RemoveAll(rootDir)).To(BeNil())
|
||||
_ = os.RemoveAll(rootDir)
|
||||
})
|
||||
|
||||
Describe("KeyMapper", func() {
|
||||
|
|
|
@ -22,6 +22,10 @@ var _ = Describe("MergeFS", func() {
|
|||
overlayDir = os.DirFS(overlayName)
|
||||
mergedDir = utils.MergeFS{Base: baseDir, Overlay: overlayDir}
|
||||
})
|
||||
AfterEach(func() {
|
||||
_ = os.RemoveAll(baseName)
|
||||
_ = os.RemoveAll(overlayName)
|
||||
})
|
||||
|
||||
It("reads from Base dir if not found in Overlay", func() {
|
||||
_f(baseName, "a.json")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue