2020-01-05 14:18:40 +01:00
|
|
|
package query
|
2019-12-11 08:18:48 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
2020-05-08 15:41:01 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/entity"
|
2019-12-11 08:18:48 +01:00
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMain(m *testing.M) {
|
|
|
|
log = logrus.StandardLogger()
|
|
|
|
log.SetLevel(logrus.DebugLevel)
|
2020-04-30 22:39:38 +02:00
|
|
|
|
2020-07-21 14:43:45 +02:00
|
|
|
if err := os.Remove(".test.db"); err == nil {
|
|
|
|
log.Debugln("removed .test.db")
|
|
|
|
}
|
|
|
|
|
2020-05-30 14:52:47 +02:00
|
|
|
db := entity.InitTestDb(os.Getenv("PHOTOPRISM_TEST_DRIVER"), os.Getenv("PHOTOPRISM_TEST_DSN"))
|
|
|
|
defer db.Close()
|
2020-04-30 22:39:38 +02:00
|
|
|
|
2019-12-11 08:18:48 +01:00
|
|
|
code := m.Run()
|
2020-04-30 22:39:38 +02:00
|
|
|
|
2019-12-11 08:18:48 +01:00
|
|
|
os.Exit(code)
|
|
|
|
}
|