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:
Peter Štibraný
2025-03-26 10:57:55 +01:00
committed by GitHub
parent c54da8f955
commit 5b5f433a26
10 changed files with 25 additions and 6 deletions
+11
View File
@@ -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