Alerting: Fix intermittency when seeding database in rule store tests (#64322)

Force unique IDs when seeding database
This commit is contained in:
Alexander Weaver 2023-03-07 08:40:55 -06:00 committed by GitHub
parent a31e18f6e3
commit 4a1c18abf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -176,7 +176,7 @@ func TestIntegration_CountAlertRules(t *testing.T) {
}
func createRule(t *testing.T, store *DBstore) *models.AlertRule {
rule := models.AlertRuleGen(withIntervalMatching(store.Cfg.BaseInterval))()
rule := models.AlertRuleGen(withIntervalMatching(store.Cfg.BaseInterval), models.WithUniqueID())()
err := store.SQLStore.WithDbSession(context.Background(), func(sess *db.Session) error {
_, err := sess.Table(models.AlertRule{}).InsertOne(rule)
if err != nil {