Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
test: Add CancelByAlertIDs empty input and no-match tests
rcourtman4765a5fa7865
diff --git a/internal/notifications/queue_test.go b/internal/notifications/queue_test.goindex d8255e5d93..50959845db 100644--- a/internal/notifications/queue_test.go+++ b/internal/notifications/queue_test.go@@ -201,3 +201,38 @@ func TestQueuedNotification_ZeroValues(t *testing.T) {t.Error("CompletedAt should be nil by default")}}++func TestCancelByAlertIDs_EmptyInput(t *testing.T) {+ // Create a temporary queue for testing+ tempDir := t.TempDir()+ nq, err := NewNotificationQueue(tempDir)+ if err != nil {+ t.Fatalf("Failed to create notification queue: %v", err)+ }++ // Empty slice should return nil without error+ err = nq.CancelByAlertIDs([]string{})+ if err != nil {+ t.Errorf("CancelByAlertIDs with empty slice returned error: %v", err)+ }++ // Nil slice should also return nil without error+ err = nq.CancelByAlertIDs(nil)+ if err != nil {+ t.Errorf("CancelByAlertIDs with nil slice returned error: %v", err)+ }+}++func TestCancelByAlertIDs_NoMatchingNotifications(t *testing.T) {+ tempDir := t.TempDir()+ nq, err := NewNotificationQueue(tempDir)+ if err != nil {+ t.Fatalf("Failed to create notification queue: %v", err)+ }++ // With an empty queue, no notifications should match+ err = nq.CancelByAlertIDs([]string{"alert-1", "alert-2"})+ if err != nil {+ t.Errorf("CancelByAlertIDs with no matching notifications returned error: %v", err)+ }+}