Notify on failed runs and with ntfy disabled
This commit is contained in:
@@ -78,9 +78,8 @@ func TestNotificationSettingsRejectUnknownOrInvalid(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// A run's end (succeeded or failed) enqueues its generic alert only for a run
|
||||
// marked "on", or for "auto" when run_finished (default off) opts into every
|
||||
// run end. Waiting notifies auto and on runs regardless; "off" never notifies.
|
||||
// Failed runs always enqueue their generic alert (unless off). Successful runs
|
||||
// require "on" or run_finished. Waiting notifies auto and on runs regardless.
|
||||
func TestRunEndEnqueueFollowsNotifyModeAndRunFinished(t *testing.T) {
|
||||
for _, status := range []string{"succeeded", "failed", "waiting"} {
|
||||
for _, tc := range []struct {
|
||||
@@ -91,6 +90,9 @@ func TestRunEndEnqueueFollowsNotifyModeAndRunFinished(t *testing.T) {
|
||||
{"auto", false, 0}, {"auto", true, 1}, {"on", false, 1}, {"on", true, 1}, {"off", false, 0}, {"off", true, 0},
|
||||
} {
|
||||
want := tc.want
|
||||
if status == "failed" && tc.mode == "auto" {
|
||||
want = 1
|
||||
}
|
||||
if status == "waiting" && tc.mode == "auto" {
|
||||
want = 1
|
||||
}
|
||||
@@ -138,7 +140,7 @@ func TestLegacyRunFinishedValueIsIgnored(t *testing.T) {
|
||||
if err := notificationTransition(ctx, s, id, "failed"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got, err := s.RunNotifications(ctx, id); err != nil || len(got) != 0 {
|
||||
if got, err := s.RunNotifications(ctx, id); err != nil || len(got) != 1 {
|
||||
t.Fatalf("notifications = %+v, %v", got, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user