collector/redfish: dedupe model-only GPU rows from graphics controllers
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user