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.

Compare guest readback at its real serialization boundaries

pulse-triage[bot]d01ee00bfb13
diff --git a/internal/monitoring/guest_memory_lifecycle_http_test.go b/internal/monitoring/guest_memory_lifecycle_http_test.go
index a85e5dea94..bfd6eb7176 100644
--- a/internal/monitoring/guest_memory_lifecycle_http_test.go
+++ b/internal/monitoring/guest_memory_lifecycle_http_test.go
@@ -136,9 +136,16 @@ func TestGuestMemoryLifecycleRestartPublishesNewSample(t *testing.T) {
t.Fatal(err)
}
var served []struct{ Proxmox unifiedresources.ProxmoxData }
- if err := json.Unmarshal(data, &served); err != nil || len(served) != 1 || served[0].Proxmox.Memory.Used != resumed.Memory.Used || served[0].Proxmox.Memory.Observation != resumed.Memory.Observation {
- t.Errorf("served memory lost the new sample: %s / %v", data, err)
+ if err := json.Unmarshal(data, &served); err != nil || len(served) != 1 || served[0].Proxmox.Memory == nil {
+ t.Fatalf("served memory missing: %s / %v", data, err)
}
+ wire := served[0].Proxmox.Memory
+ if wire.Total != resumed.Memory.Total || wire.Used != resumed.Memory.Used || wire.Free != resumed.Memory.Free || wire.Cache != resumed.Memory.Cache || wire.Usage != resumed.Memory.Usage || wire.UsageUnavailable != resumed.Memory.UsageUnavailable {
+ t.Errorf("served memory lost the numeric/availability tuple: %+v", wire)
+ }
+ // JSON preserves the instant, not Go's process-local monotonic
+ // clock component. Compare the exact wall-clock origin by Equal.
+ assertGuestMemoryObservation(t, *wire, "current", "guest-agent-meminfo", resumed.Memory.Observation.ObservedAt)
points := m.metricsHistory.GetGuestMetrics(initial.ID, "memory", time.Hour)
if len(points) != 2 || points[0].Value != 25 || points[1].Value != 50 {
t.Errorf("restart History retained old numeric memory: %+v", points)
diff --git a/internal/monitoring/monitor_host_agents_test.go b/internal/monitoring/monitor_host_agents_test.go
index 72925c75b7..8e1fa106e5 100644
--- a/internal/monitoring/monitor_host_agents_test.go
+++ b/internal/monitoring/monitor_host_agents_test.go
@@ -8468,11 +8468,12 @@ func TestRetiredQGAMemoryCannotAlterIndependentAgentEvidence(t *testing.T) {
guestMemoryCacheKey("site-other", "node", 105): entry,
}}
m.state.UpsertHost(host)
+ before := m.state.GetSnapshot().Hosts // Compare stored, cloned telemetry, not its pre-normalisation input.
m.retirePVEInstanceRuntime(instance)
if len(m.vmAgentMemCache) != 2 || m.vmAgentMemCache[guestMemoryCacheKey("site/other", "node", 105)] != entry || m.vmAgentMemCache[guestMemoryCacheKey("site-other", "node", 105)] != entry {
t.Error("connection retirement retained its own QGA memory or erased a different connection")
}
- if got := m.state.GetSnapshot().Hosts; !reflect.DeepEqual(got, []models.Host{host}) {
+ if got := m.state.GetSnapshot().Hosts; !reflect.DeepEqual(got, before) {
t.Error("QGA memory retirement changed independent Pulse-agent reports")
}
id := makeGuestID(instance, "node", 105)