Alerting: update test TestAlertingTicker to not rely on clock (#58544)

* extract method processTick
* make processTick return scheduled rules
* move state manager tests to state manager
* update test
* move all tests into one file
* remove unused fields
This commit is contained in:
Yuri Tseretyan
2022-11-09 15:08:57 -05:00
committed by GitHub
parent ee7348afee
commit bad4f28d0d
6 changed files with 430 additions and 409 deletions

View File

@@ -146,6 +146,18 @@ func WithNamespace(namespace *models2.Folder) AlertRuleMutator {
}
}
func WithInterval(interval time.Duration) AlertRuleMutator {
return func(rule *AlertRule) {
rule.IntervalSeconds = int64(interval.Seconds())
}
}
func WithTitle(title string) AlertRuleMutator {
return func(rule *AlertRule) {
rule.Title = title
}
}
func GenerateAlertLabels(count int, prefix string) data.Labels {
labels := make(data.Labels, count)
for i := 0; i < count; i++ {