Alerting: Split Scheduler and AlertRouter tests (#52416)

* move fake FakeExternalAlertmanager to sender package
* move tests from scheduler to router
* update alerts router to have all fields private
* update scheduler tests to use sender mock
This commit is contained in:
Yuriy Tseretyan
2022-07-19 09:32:54 -04:00
committed by GitHub
parent c60487fdbf
commit 054fe54b03
9 changed files with 747 additions and 500 deletions

View File

@@ -185,7 +185,15 @@ func GenerateAlertRules(count int, f func() *AlertRule) []*AlertRule {
return result
}
// GenerateGroupKey generates many random alert rules. Does not guarantee that rules are unique (by UID)
// GenerateRuleKey generates a random alert rule key
func GenerateRuleKey(orgID int64) AlertRuleKey {
return AlertRuleKey{
OrgID: orgID,
UID: util.GenerateShortUID(),
}
}
// GenerateGroupKey generates a random group key
func GenerateGroupKey(orgID int64) AlertRuleGroupKey {
return AlertRuleGroupKey{
OrgID: orgID,