mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-23 20:25:56 +00:00
Pin live row health and clear across captured resource reads
The full current-state regression now requires a critical alert to reach the same freshly projected row. Continuity controls compare a healthy VM, critical transition and clear instead of using an already-offline host as a vacuous health control. Change-source: pulse-maintainer
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user