[v9.1.x] Alerting: Mark all tests that interact with the database as Integration tests. (#56604)

Previously, two tests were not explicitly marked as integration tests
and so were not run against all 3 supported databases in the CI
environment.

(cherry picked from commit 7312a2dab0)
This commit is contained in:
Joe Blubaugh authored and GitHub committed 2022-10-11 10:04:05 +01:00
1 parent 24f22fd4c2
commit 7e2e76aa90
4 files changed
+8 -9

No files matched your search

+5 -5
View File
@@ -58,20 +58,20 @@ func AlertRuleGen(mutators ...AlertRuleMutator) func() *AlertRule {
}
rule := &AlertRule{
ID: rand.Int63(),
OrgID: rand.Int63(),
ID: rand.Int63n(1 << 30),
OrgID: rand.Int63n(1 << 30),
Title: "TEST-ALERT-" + util.GenerateShortUID(),
Condition: "A",
Data: []AlertQuery{GenerateAlertQuery()},
Updated: time.Now().Add(-time.Duration(rand.Intn(100) + 1)),
IntervalSeconds: rand.Int63n(60) + 1,
Version: rand.Int63(),
Version: rand.Int63n(1 << 30),
UID: util.GenerateShortUID(),
NamespaceUID: util.GenerateShortUID(),
DashboardUID: dashUID,
PanelID: panelID,
RuleGroup: "TEST-GROUP-" + util.GenerateShortUID(),
RuleGroupIndex: rand.Int(),
RuleGroupIndex: rand.Intn(1 << 30),
NoDataState: randNoDataState(),
ExecErrState: randErrState(),
For: forInterval,
@@ -115,7 +115,7 @@ func WithUniqueGroupIndex() AlertRuleMutator {
usedIdx := make(map[int]struct{})
return func(rule *AlertRule) {
for {
idx := rand.Int()
idx := rand.Intn(1 << 30)
if _, ok := usedIdx[idx]; !ok {
usedIdx[idx] = struct{}{}
rule.RuleGroupIndex = idx
+1 -1
View File
@@ -20,7 +20,7 @@ import (
)
func Test_subscribeToFolderChanges(t *testing.T) {
orgID := rand.Int63()
orgID := rand.Int63n(30)
folder := &models2.Folder{
Id: 0,
Uid: util.GenerateShortUID(),
@@ -16,7 +16,7 @@ import (
"github.com/grafana/grafana/pkg/util"
)
func TestUpdateAlertRules(t *testing.T) {
func TestIntegrationUpdateAlertRules(t *testing.T) {
sqlStore := sqlstore.InitTestDB(t)
store := DBstore{
SQLStore: sqlStore,
@@ -25,7 +25,6 @@ func TestUpdateAlertRules(t *testing.T) {
},
}
createRule := func(t *testing.T) *models.AlertRule {
t.Helper()
rule := models.AlertRuleGen(withIntervalMatching(store.Cfg.BaseInterval))()
err := sqlStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {
_, err := sess.Table(models.AlertRule{}).InsertOne(rule)
@@ -14,7 +14,7 @@ import (
const testAlertingIntervalSeconds = 10
func TestProvisioningStore(t *testing.T) {
func TestIntegrationProvisioningStore(t *testing.T) {
store := createProvisioningStoreSut(tests.SetupTestEnv(t, testAlertingIntervalSeconds))
t.Run("Default provenance of a known type is None", func(t *testing.T) {