Skip to content
Snippets Groups Projects
Commit 7209cf17ed9a authored by Christophe de Vienne's avatar Christophe de Vienne
Browse files

database: add a 'NoClean' test db getter

parent c2de70faf5fb
No related branches found
No related tags found
No related merge requests found
Pipeline #76090 passed
...@@ -10,9 +10,7 @@ ...@@ -10,9 +10,7 @@
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
var ( var dbtablenames []string
dbtablenames []string
)
const dbLockID = 15104 const dbLockID = 15104
...@@ -123,6 +121,12 @@ ...@@ -123,6 +121,12 @@
// GetTestDB creates a db and returns it. It must be closed within the test. // GetTestDB creates a db and returns it. It must be closed within the test.
// If it fails, t.Fatal() is called // If it fails, t.Fatal() is called
func GetTestDB(ctx context.Context, t testing.TB, sourceDriver source.Driver) *TestDB { func GetTestDB(ctx context.Context, t testing.TB, sourceDriver source.Driver) *TestDB {
db := GetTestDBNoClear(ctx, t, sourceDriver)
db.ClearDB()
return db
}
func GetTestDBNoClear(ctx context.Context, t testing.TB, sourceDriver source.Driver) *TestDB {
var success bool var success bool
dsn := getDSN(t) dsn := getDSN(t)
...@@ -187,8 +191,6 @@ ...@@ -187,8 +191,6 @@
); err != nil { ); err != nil {
t.Fatal(err) t.Fatal(err)
} }
} else {
testDB.ClearDB()
} }
success = true success = true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment