fix(alerting): Use reflection to set invalid providers to nil instead of re-validating on every alert trigger/resolve

This commit is contained in:
TwiN
2022-12-15 20:54:38 -05:00
parent a5f135c675
commit dfcea93080
4 changed files with 22 additions and 7 deletions

View File

@ -980,11 +980,8 @@ endpoints:
if config.Alerting == nil {
t.Fatal("config.Alerting shouldn't have been nil")
}
if config.Alerting.PagerDuty == nil {
t.Fatal("PagerDuty alerting config shouldn't have been nil")
}
if config.Alerting.PagerDuty.IsValid() {
t.Fatal("PagerDuty alerting config should've been invalid")
if config.Alerting.PagerDuty != nil {
t.Fatal("PagerDuty alerting config should've been set to nil, because its IsValid() method returned false and therefore alerting.Config.SetAlertingProviderToNil() should've been called")
}
}