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.

Keep replay receivers alive until their owned senders stop

pulse-triage[bot]8ea10303068f
diff --git a/internal/notifications/firing_group_checkpoint_test.go b/internal/notifications/firing_group_checkpoint_test.go
index d6673bd5c9..5cd0e521d5 100644
--- a/internal/notifications/firing_group_checkpoint_test.go
+++ b/internal/notifications/firing_group_checkpoint_test.go
@@ -280,7 +280,7 @@ func TestCheckpointReplayRechecksCurrentPolicy(t *testing.T) {
t.Run(policy, func(t *testing.T) {
var received atomic.Int32
server := newIPv4HTTPServer(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { received.Add(1); w.WriteHeader(http.StatusOK) }))
- defer server.Close()
+ t.Cleanup(server.Close)
dir := t.TempDir()
hook := WebhookConfig{ID: "ops", URL: server.URL, Enabled: true, Service: "generic"}
open := func(add bool) *NotificationManager {
@@ -314,7 +314,10 @@ func TestCheckpointReplayRechecksCurrentPolicy(t *testing.T) {
})
}
m.StartQueueProcessing()
- awaitShutdownCondition(t, "checkpoint replay policy verdict", func() bool {
+ // This is an asynchronous completion watchdog, not a delivery-latency
+ // SLO. Allow the configured HTTP timeout plus a queue discovery tick;
+ // the old ten-second helper could tear down a still-owned request.
+ require.Eventually(t, func() bool {
rows := quietReplayRows(t, m.GetQueue())
if len(rows) != 1 {
return false
@@ -329,7 +332,7 @@ func TestCheckpointReplayRechecksCurrentPolicy(t *testing.T) {
default:
return rows[0].Status == QueueStatusCancelled
}
- })
+ }, WebhookTimeout+10*time.Second, 10*time.Millisecond, "checkpoint replay policy verdict")
entries, err := m.GetQueue().GetDeliveryLog(time.Now().Add(-time.Hour), 100)
require.NoError(t, err)
if policy == "allowed" {
diff --git a/internal/notifications/firing_group_process_test.go b/internal/notifications/firing_group_process_test.go
index 11575f736f..dc9ff28b71 100644
--- a/internal/notifications/firing_group_process_test.go
+++ b/internal/notifications/firing_group_process_test.go
@@ -194,7 +194,7 @@ func TestGroupedWarningGracefulProcessRestartAndReload(t *testing.T) {
received <- d
w.WriteHeader(200)
}))
- defer server.Close()
+ t.Cleanup(server.Close)
dir := t.TempDir()
type child struct {
cmd *exec.Cmd