photoprism/internal/entity/entity_test.go
Michael Mayer c5dbe1bc14 Backend: Refactor database migration
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-05-08 17:45:32 +02:00

29 lines
358 B
Go

package entity
import (
"os"
"testing"
"github.com/sirupsen/logrus"
)
func TestMain(m *testing.M) {
log = logrus.StandardLogger()
log.SetLevel(logrus.DebugLevel)
dsn := os.Getenv("PHOTOPRISM_TEST_DSN")
if dsn == "" {
panic("database dsn is empty")
}
db := InitTestDb(dsn)
code := m.Run()
if db != nil {
db.Close()
}
os.Exit(code)
}