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.

Verify native CORE memory after canonical registry ingestion

pulse-triage[bot]9944d0e1b442
diff --git a/internal/truenas/core_realtime_memory_test.go b/internal/truenas/core_realtime_memory_test.go
index af6694a2cb..24558f77cf 100644
--- a/internal/truenas/core_realtime_memory_test.go
+++ b/internal/truenas/core_realtime_memory_test.go
@@ -242,10 +242,12 @@ func TestCORE13RealtimeMemoryJourney(t *testing.T) {
t.Fatal("native memory lost freshness/independent REST inventory/readings")
}
records := truenasRecordsFromSnapshot(snapshot, "synthetic-core-connection", nil)
+ registry := unifiedresources.NewRegistry(nil)
+ registry.IngestRecords(unifiedresources.SourceTrueNAS, records)
var host *unifiedresources.Resource
- for _, rec := range records {
- if rec.Resource.Type == unifiedresources.ResourceTypeAgent {
- copy := rec.Resource
+ for _, resource := range registry.List() {
+ if resource.Type == unifiedresources.ResourceTypeAgent {
+ copy := resource
host = &copy
}
}
@@ -253,6 +255,9 @@ func TestCORE13RealtimeMemoryJourney(t *testing.T) {
t.Fatal("native memory did not reach canonical host")
}
wantUsed := int64(34277445632 - 1079291904 - 25668261968)
+ if host.ID == "" || len(host.Sources) != 1 || host.Sources[0] != unifiedresources.SourceTrueNAS {
+ t.Fatal("native memory did not acquire canonical source/identity")
+ }
if host.Agent.Memory.Cache != 25668261968 || host.Agent.Memory.Free != 1079291904 || host.Agent.Memory.Used != wantUsed || *host.Metrics.Memory.Used != wantUsed {
t.Fatalf("canonical memory lost native meaning: %+v %+v", host.Agent.Memory, host.Metrics.Memory)
}