Alerting: Mark all tests that interact with the database as Integration tests. (#54875)

Previously, two tests were not explicitly marked as integration tests
and so were not run against all 3 supported databases in the CI
environment.
This commit is contained in:
Joe Blubaugh 2022-10-10 13:54:54 +08:00 committed by GitHub
parent b24be6c0fc
commit 7312a2dab0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -17,7 +17,7 @@ import (
"github.com/grafana/grafana/pkg/util" "github.com/grafana/grafana/pkg/util"
) )
func TestUpdateAlertRules(t *testing.T) { func TestIntegrationUpdateAlertRules(t *testing.T) {
sqlStore := sqlstore.InitTestDB(t) sqlStore := sqlstore.InitTestDB(t)
store := DBstore{ store := DBstore{
SQLStore: sqlStore, SQLStore: sqlStore,
@ -26,7 +26,6 @@ func TestUpdateAlertRules(t *testing.T) {
}, },
} }
createRule := func(t *testing.T) *models.AlertRule { createRule := func(t *testing.T) *models.AlertRule {
t.Helper()
rule := models.AlertRuleGen(withIntervalMatching(store.Cfg.BaseInterval))() rule := models.AlertRuleGen(withIntervalMatching(store.Cfg.BaseInterval))()
err := sqlStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error { err := sqlStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {
_, err := sess.Table(models.AlertRule{}).InsertOne(rule) _, err := sess.Table(models.AlertRule{}).InsertOne(rule)
@ -94,7 +93,7 @@ func withIntervalMatching(baseInterval time.Duration) func(*models.AlertRule) {
} }
} }
func Test_getFilterByOrgsString(t *testing.T) { func TestIntegration_getFilterByOrgsString(t *testing.T) {
testCases := []struct { testCases := []struct {
testName string testName string
orgs map[int64]struct{} orgs map[int64]struct{}

View File

@ -14,7 +14,7 @@ import (
const testAlertingIntervalSeconds = 10 const testAlertingIntervalSeconds = 10
func TestProvisioningStore(t *testing.T) { func TestIntegrationProvisioningStore(t *testing.T) {
store := createProvisioningStoreSut(tests.SetupTestEnv(t, testAlertingIntervalSeconds)) store := createProvisioningStoreSut(tests.SetupTestEnv(t, testAlertingIntervalSeconds))
t.Run("Default provenance of a known type is None", func(t *testing.T) { t.Run("Default provenance of a known type is None", func(t *testing.T) {