# HG changeset patch
# User Christophe de Vienne <christophe@cdevienne.info>
# Date 1705948374 -3600
#      Mon Jan 22 19:32:54 2024 +0100
# Node ID 7209cf17ed9ac7fa5c8aff8dedfab1b9445a7447
# Parent  c2de70faf5fb54711c2bf0c6f16f3103e81fa900
database: add a 'NoClean' test db getter

diff --git a/database/test.go b/database/test.go
--- a/database/test.go
+++ b/database/test.go
@@ -10,9 +10,7 @@
 	"github.com/stretchr/testify/require"
 )
 
-var (
-	dbtablenames []string
-)
+var dbtablenames []string
 
 const dbLockID = 15104
 
@@ -123,6 +121,12 @@
 // GetTestDB creates a db and returns it. It must be closed within the test.
 // If it fails, t.Fatal() is called
 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
 
 	dsn := getDSN(t)
@@ -187,8 +191,6 @@
 		); err != nil {
 			t.Fatal(err)
 		}
-	} else {
-		testDB.ClearDB()
 	}
 
 	success = true