Added tests and readme

This commit is contained in:
2026-05-12 06:20:51 +00:00
parent 7e85bb0fcc
commit 139c224a31
23 changed files with 1449 additions and 97 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ func (d *Dispatcher) OnTransition(check *config.Check, from, to checks.State, sn
}
msg := Render(d.selfID, check, from, to, snap)
for _, alertID := range check.AlertIDs {
alert, _ := d.cluster.FindAlert(alertID)
alert := d.cluster.FindAlert(alertID)
if alert == nil {
d.logger.Printf("alerts: check %q references unknown alert %q", check.Name, alertID)
continue
@@ -46,7 +46,7 @@ func (d *Dispatcher) OnTransition(check *config.Check, from, to checks.State, sn
// Test sends a one-shot test message to the named alert. Returns an
// error so the CLI can surface failures interactively.
func (d *Dispatcher) Test(alertID string) error {
alert, _ := d.cluster.FindAlert(alertID)
alert := d.cluster.FindAlert(alertID)
if alert == nil {
return fmt.Errorf("alert %q not found", alertID)
}