Alerting: Fix flaky TestIntegrationUpdateAlertRules (#61641)

Prevents random OrgID=0 in test alert generation causing invalid alert rule.
This commit is contained in:
Matthew Jacobson 2023-01-17 14:09:46 -05:00 committed by GitHub
parent 3fe81b3c3f
commit 23e05373a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 2 deletions

View File

@ -60,7 +60,7 @@ func AlertRuleGen(mutators ...AlertRuleMutator) func() *AlertRule {
rule := &AlertRule{
ID: rand.Int63n(1500),
OrgID: rand.Int63n(1500),
OrgID: rand.Int63n(1500) + 1, // Prevent OrgID=0 as this does not pass alert rule validation.
Title: "TEST-ALERT-" + util.GenerateShortUID(),
Condition: "A",
Data: []AlertQuery{GenerateAlertQuery()},

View File

@ -52,7 +52,6 @@ func TestIntegrationUpdateAlertRules(t *testing.T) {
})
t.Run("should fail due to optimistic locking if version does not match", func(t *testing.T) {
t.Skip() // This test intermittently fails.
rule := createRule(t, store)
rule.Version-- // simulate version discrepancy