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.

Pin live row health and clear across captured resource reads

pulse-triage[bot]8b12e0ee1b67
diff --git a/internal/monitoring/broadcast_metrics_snapshot_test.go b/internal/monitoring/broadcast_metrics_snapshot_test.go
index f774d14b72..a6eef3d7af 100644
--- a/internal/monitoring/broadcast_metrics_snapshot_test.go
+++ b/internal/monitoring/broadcast_metrics_snapshot_test.go
@@ -177,9 +177,16 @@ func TestBroadcastMetricsSnapshotContinuityAndLiveOverlays(t *testing.T) {
}
}
}
- critical := unifiedresources.EvaluateResourceHealth(host, []unifiedresources.ResourceHealthAlert{{ResourceID: host.ID, Level: "critical", Type: "cpu"}}, now)
- if critical.Verdict != unifiedresources.HealthCritical {
- t.Fatal("live alert was hidden by captured data")
+ for _, r := range view.resources {
+ if r.Type != unifiedresources.ResourceTypeVM {
+ continue
+ }
+ baseline := unifiedresources.EvaluateResourceHealth(r, nil, now)
+ critical := unifiedresources.EvaluateResourceHealth(r, []unifiedresources.ResourceHealthAlert{{ResourceID: r.ID, Level: "critical", Type: "cpu"}}, now)
+ cleared := unifiedresources.EvaluateResourceHealth(r, nil, now)
+ if baseline.Verdict != unifiedresources.HealthOK || critical.Verdict != unifiedresources.HealthCritical || !reflect.DeepEqual(cleared, baseline) {
+ t.Fatal("live alert/clear was hidden by captured data")
+ }
}
if len(adapter.GetAll()) != 2 {
t.Fatal("continuity overlay wrote back to the live registry")
diff --git a/internal/monitoring/monitor_host_agents_test.go b/internal/monitoring/monitor_host_agents_test.go
index 695d475395..b7d3708922 100644
--- a/internal/monitoring/monitor_host_agents_test.go
+++ b/internal/monitoring/monitor_host_agents_test.go
@@ -6763,6 +6763,10 @@ func TestBroadcastProjectionListsRegistryOnceAndKeepsLiveChanges(t *testing.T) {
if row == nil || row.CPU.Current != 77 || len(row.Tags) != 1 || row.Tags[0] != "new-tag" {
t.Fatalf("mutable row was stale: %#v", row)
}
+ var health unifiedresources.ResourceHealth
+ if err := json.Unmarshal(row.Health, &health); err != nil || health.Verdict != unifiedresources.HealthCritical {
+ t.Fatalf("live critical alert did not reach the freshly projected row: %s (%v)", row.Health, err)
+ }
if first.Resources[0].CPU.Current != oldCPU {
t.Fatal("later projection mutated an accepted baseline")
}