mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-24 04:33:17 +00:00
Use canonical resource fields in broadcast regression fixtures
The first exact candidate proof compiled and passed frontend snapshot tests, but rejected two monitoring fixture fields that only exist on frontend projections. Use the canonical resource name and tags to test the same sort/freshness boundaries. Preserve that failed aggregate result; no production code or expectation is relaxed. Change-source: pulse-maintainer
This commit is contained in:
@@ -27,13 +27,13 @@ projection converter. Conversion sorts final frontend rows beside precomputed
|
||||
keys instead of retaining an estate-sized array of conversion inputs. This
|
||||
must preserve canonical identity, parent/action targets, catalogs, ordering,
|
||||
ignore surfaces and source isolation. No timestamp/generation cache is added:
|
||||
metrics, labels, alert state, metadata clears and time-sensitive health continue
|
||||
metrics, tags, alert state, metadata clears and time-sensitive health continue
|
||||
to be evaluated on each requested broadcast.
|
||||
|
||||
`TestBroadcastProjectionMatchesPreviousPipeline` compares full JSON with the
|
||||
pre-repair conversion/sort/coalesce pipeline on split hosts and mixed workloads.
|
||||
`TestBroadcastProjectionListsRegistryOnceAndKeepsLiveChanges` pins one registry
|
||||
list and verifies same-freshness metric/label changes, live alerts, ignored
|
||||
list and verifies same-freshness metric/tag changes, live alerts, ignored
|
||||
hosts and immutable prior projections. The 1,000-resource broadcast benchmark
|
||||
includes real registry cloning, projection, encoding, per-client deltas and
|
||||
queues with zero/one/four viewers, not persistence, transport or installed CPU.
|
||||
|
||||
@@ -2921,7 +2921,7 @@ func TestBroadcastProjectionMatchesPreviousPipeline(t *testing.T) {
|
||||
for i, name := range []string{"zebra", "Alpha", "alpha", "", "尾"} {
|
||||
parent := "agent-api"
|
||||
resources = append(resources, unifiedresources.Resource{
|
||||
ID: fmt.Sprintf("vm-%d", i), Type: unifiedresources.ResourceTypeVM, Name: name, DisplayName: name,
|
||||
ID: fmt.Sprintf("vm-%d", i), Type: unifiedresources.ResourceTypeVM, Name: name,
|
||||
ParentID: &parent, Status: unifiedresources.StatusOnline, LastSeen: now,
|
||||
Proxmox: &unifiedresources.ProxmoxData{NodeName: "tower.local", VMID: i + 100},
|
||||
Sources: []unifiedresources.DataSource{unifiedresources.SourceProxmox},
|
||||
|
||||
@@ -6660,9 +6660,9 @@ func TestBroadcastProjectionListsRegistryOnceAndKeepsLiveChanges(t *testing.T) {
|
||||
oldCPU := first.Resources[0].CPU.Current
|
||||
changed := store.GetAll()
|
||||
// Keep LastSeen/overall freshness unchanged: a timestamp-only cache would
|
||||
// miss these metric/status/label changes.
|
||||
// miss these metric/status/tag changes.
|
||||
changed[0].Metrics.CPU.Value = 77
|
||||
changed[0].Labels = map[string]string{"new": "label"}
|
||||
changed[0].Tags = []string{"new-tag"}
|
||||
changed[0].Status = unifiedresources.StatusOffline
|
||||
registry := unifiedresources.NewRegistry(nil)
|
||||
registry.IngestResources(changed)
|
||||
@@ -6680,7 +6680,7 @@ func TestBroadcastProjectionListsRegistryOnceAndKeepsLiveChanges(t *testing.T) {
|
||||
row = &second.Resources[i]
|
||||
}
|
||||
}
|
||||
if row == nil || row.CPU.Current != 77 || row.Labels["new"] != "label" {
|
||||
if row == nil || row.CPU.Current != 77 || len(row.Tags) != 1 || row.Tags[0] != "new-tag" {
|
||||
t.Fatalf("mutable row was stale: %#v", row)
|
||||
}
|
||||
if first.Resources[0].CPU.Current != oldCPU {
|
||||
|
||||
Reference in New Issue
Block a user