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(monitoring): await the accepted startup notification

rcourtman2d380af6580e
diff --git a/internal/monitoring/monitor_notification_startup_test.go b/internal/monitoring/monitor_notification_startup_test.go
index 780bcc21c9..7ef752c0d7 100644
--- a/internal/monitoring/monitor_notification_startup_test.go
+++ b/internal/monitoring/monitor_notification_startup_test.go
@@ -305,21 +305,30 @@ func TestNewRestoresSharedWebhookPolicyBeforeQueueActivation(t *testing.T) {
}
defer m.Stop()
q := m.GetNotificationManager().GetQueue()
- want := "dlq"
+ want := notifications.DeliveryOutcomeDeadLetter
if tc.allowed {
- want = "sent"
+ want = notifications.DeliveryOutcomeSent
}
deadline := time.Now().Add(5 * time.Second)
for {
- stats, err := q.GetQueueStats()
+ entries, err := q.GetDeliveryLog(time.Now().Add(-time.Hour), 10)
if err != nil {
t.Fatal(err)
}
- if stats[want] == 1 {
+ // A blocked destination can also queue a delivery-health alert.
+ // Observe the accepted row, not the total number of outcomes.
+ reached := false
+ for _, entry := range entries {
+ if entry.NotificationID == "accepted-before-restart" && entry.Outcome == want {
+ reached = true
+ break
+ }
+ }
+ if reached {
break
}
if time.Now().After(deadline) {
- t.Fatalf("BOOTSTRAP_POLICY: accepted row did not reach %s before router construction: %v", want, stats)
+ t.Fatalf("BOOTSTRAP_POLICY: accepted row did not reach %s before router construction: %+v", want, entries)
}
time.Sleep(10 * time.Millisecond)
}