mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Allow skip migrations in tests via environment variable (#32958)
This commit is contained in:
parent
501d5fbcc2
commit
01150ae962
@ -447,6 +447,15 @@ func InitTestDB(t ITestDB, opts ...InitTestDBOpt) *SQLStore {
|
||||
}
|
||||
}
|
||||
|
||||
// useful if you already have a database that you want to use for tests.
|
||||
// cannot just set it on testSQLStore as it overrides the config in Init
|
||||
if _, present := os.LookupEnv("SKIP_MIGRATIONS"); present {
|
||||
t.Log("Skipping database migrations")
|
||||
if _, err := sec.NewKey("skip_migrations", "true"); err != nil {
|
||||
t.Fatalf("Failed to create key: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
// need to get engine to clean db before we init
|
||||
t.Logf("Creating database connection: %q", sec.Key("connection_string"))
|
||||
engine, err := xorm.NewEngine(dbType, sec.Key("connection_string").String())
|
||||
|
Loading…
Reference in New Issue
Block a user