diff --git a/database/test.go b/database/test.go index 50adb735d16e1616de8f6e28b29a8e70a612649c_ZGF0YWJhc2UvdGVzdC5nbw==..6a6bbb024bf5cd07682707b222e7f8a3ec49c16a_ZGF0YWJhc2UvdGVzdC5nbw== 100644 --- a/database/test.go +++ b/database/test.go @@ -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 "+