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

TestDB: add flags

parent c357c7fe2042
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,16 @@ ...@@ -42,6 +42,16 @@
ctx context.Context ctx context.Context
tb testing.TB tb testing.TB
lockConn *sqlx.Conn 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 // SetTB changes the current tb and returns a function to restore the original one
...@@ -126,7 +136,7 @@ ...@@ -126,7 +136,7 @@
success = true 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. // GetTestDB creates a db and returns it. It must be closed within the test.
...@@ -192,7 +202,7 @@ ...@@ -192,7 +202,7 @@
} }
} }
testDB := TestDB{db, dsn, ctx, t, c} testDB := TestDB{db, dsn, ctx, t, c, make(map[string]bool)}
if len(dbtablenames) == 0 { if len(dbtablenames) == 0 {
if err := db.Select(&dbtablenames, if err := db.Select(&dbtablenames,
"SELECT tablename "+ "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