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

TestDB: add flags

parent 50adb735d16e
No related branches found
No related tags found
No related merge requests found
Pipeline #118471 passed
......@@ -44,6 +44,16 @@
ctx context.Context
tb testing.TB
lockConn *sqlx.Conn
flags map[string]bool
}
func (db *TestDB) GetFlag(name string) bool {
return db.flags[name]
}
func (db *TestDB) SetFlag(name string, value bool) {
db.flags[name] = value
}
// SetTB changes the current tb and returns a function to restore the original one.
......@@ -131,7 +141,7 @@
success = true
return &TestDB{db, dsn, ctx, tb, c}
return &TestDB{db, dsn, ctx, tb, c, make(map[string]bool)}
}
// GetTestDB creates a db and returns it. It must be closed within the test.
......@@ -200,7 +210,7 @@
}
}
testDB := TestDB{db, dsn, ctx, tb, c}
testDB := TestDB{db, dsn, ctx, tb, c, make(map[string]bool)}
if len(dbtablenames) == 0 {
if err := db.Select(&dbtablenames,
"SELECT tablename "+
......
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