mysql: mysql tests should use a db server with UTC

To get rid of issues involving date/time when testing.
Also, makes it possible to run mysql integration tests for both
grafana config db and tsdb at the same time using
GRAFANA_TEST_DB=mysql go test ./pkg/...
This commit is contained in:
Marcus Efraimsson
2018-04-10 10:58:45 +02:00
parent a314890f89
commit 5c120c2c11
6 changed files with 156 additions and 62 deletions
+10 -1
View File
@@ -258,7 +258,7 @@ func InitTestDB(t *testing.T) *xorm.Engine {
// x.ShowSQL()
if err != nil {
t.Fatalf("Failed to init in memory sqllite3 db %v", err)
t.Fatalf("Failed to init test database: %v", err)
}
sqlutil.CleanDB(x)
@@ -269,3 +269,12 @@ func InitTestDB(t *testing.T) *xorm.Engine {
return x
}
func IsTestDbMySql() bool {
if db, present := os.LookupEnv("GRAFANA_TEST_DB"); present {
return db == dbMySql
}
return false
}