collector/redfish: dedupe model-only GPU rows from graphics controllers

This commit is contained in:
2026-02-28 13:04:34 +03:00
parent 6c19a58b24
commit b918363252
3 changed files with 86 additions and 0 deletions
+47
View File
@@ -644,3 +644,50 @@ func TestReplayRedfishFromRawPayloads_AddsMissingServerModelWarning(t *testing.T
t.Fatalf("expected collection warning event about missing server model")
}
}
func TestReplayCollectGPUs_SkipsModelOnlyDuplicateFromGraphicsControllers(t *testing.T) {
r := redfishSnapshotReader{tree: map[string]interface{}{
"/redfish/v1/Systems/1/PCIeDevices": map[string]interface{}{
"Members": []interface{}{
map[string]interface{}{"@odata.id": "/redfish/v1/Systems/1/PCIeDevices/3"},
map[string]interface{}{"@odata.id": "/redfish/v1/Systems/1/PCIeDevices/9"},
},
},
"/redfish/v1/Systems/1/PCIeDevices/3": map[string]interface{}{
"Id": "3",
"Name": "PCIeCard3",
"Model": "H200-SXM5-141G",
"Manufacturer": "NVIDIA",
"SerialNumber": "1654225094493",
},
"/redfish/v1/Systems/1/PCIeDevices/9": map[string]interface{}{
"Id": "9",
"Name": "PCIeCard9",
"Model": "H200-SXM5-141G",
"Manufacturer": "NVIDIA",
"SerialNumber": "1654425002635",
},
"/redfish/v1/Systems/1/GraphicsControllers": map[string]interface{}{
"Members": []interface{}{
map[string]interface{}{"@odata.id": "/redfish/v1/Systems/1/GraphicsControllers/GPU0"},
},
},
"/redfish/v1/Systems/1/GraphicsControllers/GPU0": map[string]interface{}{
"Id": "GPU0",
"Name": "H200-SXM5-141G",
"Model": "H200-SXM5-141G",
"Manufacturer": "NVIDIA",
"SerialNumber": "N/A",
},
}}
got := r.collectGPUs([]string{"/redfish/v1/Systems/1"}, nil)
if len(got) != 2 {
t.Fatalf("expected 2 GPUs without generic duplicate, got %d", len(got))
}
for _, gpu := range got {
if gpu.Slot == "H200-SXM5-141G" {
t.Fatalf("unexpected model-only duplicate GPU row")
}
}
}