spanner: Disable running alerting integration tests when using spanner. (#102730)
* Disable running alerting integration tests when using spanner. * Disable tests for templategroup.
This commit is contained in:
@@ -414,6 +414,7 @@ var testSQLStoreSetup = false
|
||||
var testSQLStore *SQLStore
|
||||
var testSQLStoreMutex sync.Mutex
|
||||
var testSQLStoreCleanup []func()
|
||||
var testSQLStoreSkipTestsOnBackend string // When not empty and matches DB type, test is skipped.
|
||||
|
||||
// InitTestDBOpt contains options for InitTestDB.
|
||||
type InitTestDBOpt struct {
|
||||
@@ -458,6 +459,12 @@ func SetupTestDB() {
|
||||
testSQLStoreSetup = true
|
||||
}
|
||||
|
||||
func SkipTestsOnSpanner() {
|
||||
testSQLStoreMutex.Lock()
|
||||
defer testSQLStoreMutex.Unlock()
|
||||
testSQLStoreSkipTestsOnBackend = "spanner"
|
||||
}
|
||||
|
||||
func CleanupTestDB() {
|
||||
testSQLStoreMutex.Lock()
|
||||
defer testSQLStoreMutex.Unlock()
|
||||
@@ -542,6 +549,10 @@ func TestMain(m *testing.M) {
|
||||
if testSQLStore == nil {
|
||||
dbType := sqlutil.GetTestDBType()
|
||||
|
||||
if testSQLStoreSkipTestsOnBackend != "" && testSQLStoreSkipTestsOnBackend == dbType {
|
||||
t.Skipf("test skipped when using DB type %s", testSQLStoreSkipTestsOnBackend)
|
||||
}
|
||||
|
||||
// set test db config
|
||||
cfg := setting.NewCfg()
|
||||
// nolint:staticcheck
|
||||
|
||||
Reference in New Issue
Block a user