mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-19 05:17:41 +03:00
Change tests' db path to a temp folder
This commit is contained in:
parent
4b1c909a4d
commit
6c05930444
@ -1,10 +1,8 @@
|
||||
package db_storm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"github.com/asdine/storm"
|
||||
@ -24,7 +22,6 @@ func Db() *storm.DB {
|
||||
panic(err)
|
||||
}
|
||||
dbPath := path.Join(conf.Sonic.DbPath, "storm.db")
|
||||
dbPath = fmt.Sprintf(".%c%s", filepath.Separator, dbPath)
|
||||
instance, err := storm.Open(dbPath)
|
||||
log.Debug("Opening Storm DB from: " + dbPath)
|
||||
if err != nil {
|
||||
|
@ -1,15 +1,19 @@
|
||||
package db_storm
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/cloudsonic/sonic-server/conf"
|
||||
"github.com/cloudsonic/sonic-server/domain"
|
||||
"github.com/cloudsonic/sonic-server/log"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
func TestStormPersistence(t *testing.T) {
|
||||
//log.SetLevel(log.LevelCritical)
|
||||
log.SetLevel(log.LevelCritical)
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Storm Persistence Suite")
|
||||
}
|
||||
@ -27,6 +31,8 @@ var testArtists = domain.Artists{
|
||||
|
||||
var _ = Describe("Initialize test DB", func() {
|
||||
BeforeSuite(func() {
|
||||
conf.Sonic.DbPath, _ = ioutil.TempDir("", "cloudsonic_tests")
|
||||
os.MkdirAll(conf.Sonic.DbPath, 0700)
|
||||
Db().Drop(&_Album{})
|
||||
albumRepo := NewAlbumRepository()
|
||||
for _, a := range testAlbums {
|
||||
|
Loading…
x
Reference in New Issue
Block a user