Add raw export reanalyze flow for Redfish snapshots
This commit is contained in:
@@ -200,3 +200,41 @@ func TestRedfishConnectorCollect(t *testing.T) {
|
||||
t.Fatalf("expected non-empty redfish_tree, got %#v", treeAny)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParsePCIeDeviceSlot_FromNestedRedfishSlotLocation(t *testing.T) {
|
||||
doc := map[string]interface{}{
|
||||
"Id": "NIC1",
|
||||
"Slot": map[string]interface{}{
|
||||
"Lanes": 16,
|
||||
"Location": map[string]interface{}{
|
||||
"PartLocation": map[string]interface{}{
|
||||
"LocationOrdinalValue": 1,
|
||||
"LocationType": "Slot",
|
||||
"ServiceLabel": "PCIe Slot 1 (1)",
|
||||
},
|
||||
},
|
||||
"PCIeType": "Gen5",
|
||||
"SlotType": "FullLength",
|
||||
},
|
||||
}
|
||||
|
||||
got := parsePCIeDevice(doc, nil)
|
||||
if got.Slot != "PCIe Slot 1 (1)" {
|
||||
t.Fatalf("unexpected slot: %q", got.Slot)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParsePCIeDeviceSlot_EmptyMapFallsBackToID(t *testing.T) {
|
||||
doc := map[string]interface{}{
|
||||
"Id": "NIC42",
|
||||
"Slot": map[string]interface{}{},
|
||||
}
|
||||
|
||||
got := parsePCIeDevice(doc, nil)
|
||||
if got.Slot != "NIC42" {
|
||||
t.Fatalf("unexpected slot fallback: %q", got.Slot)
|
||||
}
|
||||
if got.Slot == "map[]" {
|
||||
t.Fatalf("slot should not stringify empty map")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user