2019-12-11 16:55:18 +01:00
|
|
|
package entity
|
2019-05-16 04:03:55 +02:00
|
|
|
|
|
|
|
import (
|
2019-12-11 19:11:44 +01:00
|
|
|
"bytes"
|
2019-05-16 04:03:55 +02:00
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
2019-12-11 19:11:44 +01:00
|
|
|
"github.com/sirupsen/logrus"
|
2019-05-16 04:03:55 +02:00
|
|
|
)
|
|
|
|
|
2019-12-11 19:11:44 +01:00
|
|
|
var logBuffer bytes.Buffer
|
|
|
|
|
2019-05-16 04:03:55 +02:00
|
|
|
func TestMain(m *testing.M) {
|
2019-12-11 19:11:44 +01:00
|
|
|
log = logrus.StandardLogger()
|
|
|
|
log.Out = &logBuffer
|
|
|
|
log.SetLevel(logrus.DebugLevel)
|
2020-04-30 20:07:03 +02:00
|
|
|
|
2020-04-30 22:39:38 +02:00
|
|
|
db := InitTestDb(os.Getenv("PHOTOPRISM_TEST_DSN"))
|
2020-04-30 20:07:03 +02:00
|
|
|
|
2019-05-16 04:03:55 +02:00
|
|
|
code := m.Run()
|
2020-04-30 20:07:03 +02:00
|
|
|
|
|
|
|
db.Close()
|
|
|
|
|
2019-05-16 04:03:55 +02:00
|
|
|
os.Exit(code)
|
|
|
|
}
|