Alerting: Restart rule routines if the type changes (#90867)

* Restart when types change

* Wire up test hooks correctly

* testing
This commit is contained in:
Alexander Weaver
2024-08-14 14:57:47 -05:00
committed by GitHub
parent f158d52ae4
commit 34ab5fe1f3
8 changed files with 160 additions and 14 deletions
+3 -3
View File
@@ -495,13 +495,13 @@ func (a *AlertRuleMutators) WithRandomRecordingRules() AlertRuleMutator {
if rand.Int63()%2 == 0 {
return
}
convertToRecordingRule(rule)
ConvertToRecordingRule(rule)
}
}
func (a *AlertRuleMutators) WithAllRecordingRules() AlertRuleMutator {
return func(rule *AlertRule) {
convertToRecordingRule(rule)
ConvertToRecordingRule(rule)
}
}
@@ -1092,7 +1092,7 @@ func (n SilenceMutators) WithEmptyId() Mutator[Silence] {
}
}
func convertToRecordingRule(rule *AlertRule) {
func ConvertToRecordingRule(rule *AlertRule) {
if rule.Record == nil {
rule.Record = &Record{}
}