Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

test(notifications): isolate queued routing snapshot

pulse-triage[bot]75aaf1391c3d
diff --git a/internal/notifications/queue_policy_change_test.go b/internal/notifications/queue_policy_change_test.go
index c3b3c4b4f9..5837e6dfda 100644
--- a/internal/notifications/queue_policy_change_test.go
+++ b/internal/notifications/queue_policy_change_test.go
@@ -35,6 +35,13 @@ func TestQueuedEmailRoutingChangeAndResolution(t *testing.T) {
t.Fatalf("queued email = %v, %v", pending, err)
}
old := pending[0]
+ // The queue's background worker starts at construction and SetProcessor
+ // wakes it. Keep this row out of GetPending while exercising the
+ // already-fetched worker snapshot synchronously below.
+ futureRetry := time.Now().Add(time.Hour)
+ if _, err := q.db.Exec(`UPDATE notification_queue SET next_retry_at = ? WHERE id = ?`, futureRetry.Unix(), old.ID); err != nil {
+ t.Fatal(err)
+ }
n.SetInitialNotifyTarget("webhook")
// A fetched worker item must not defeat resolution cancellation.
if resolve {