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): remove queue stats race with background processor

rcourtmana3fcaafbdb8c
diff --git a/internal/notifications/queue_test.go b/internal/notifications/queue_test.go
index be04138554..157f86e4f4 100644
--- a/internal/notifications/queue_test.go
+++ b/internal/notifications/queue_test.go
@@ -613,10 +613,14 @@ func TestGetQueueStats(t *testing.T) {
}
defer nq.Stop()
+ // Keep pending notifications out of the runnable window so the background
+ // processor can't race this test and mutate statuses before assertions.
+ futureRetry := time.Now().Add(1 * time.Hour)
+
// Enqueue notifications with different statuses
notifications := []*QueuedNotification{
- {ID: "pending-1", Type: "email", Status: QueueStatusPending, MaxAttempts: 3, Config: []byte(`{}`)},
- {ID: "pending-2", Type: "email", Status: QueueStatusPending, MaxAttempts: 3, Config: []byte(`{}`)},
+ {ID: "pending-1", Type: "email", Status: QueueStatusPending, MaxAttempts: 3, Config: []byte(`{}`), NextRetryAt: &futureRetry},
+ {ID: "pending-2", Type: "email", Status: QueueStatusPending, MaxAttempts: 3, Config: []byte(`{}`), NextRetryAt: &futureRetry},
{ID: "sending-1", Type: "webhook", Status: QueueStatusSending, MaxAttempts: 3, Config: []byte(`{}`)},
}