Add raw export reanalyze flow for Redfish snapshots

This commit is contained in:
Mikhail Chusavitin
2026-02-24 17:23:26 +03:00
parent 5d9e9d73de
commit 810c4b5ff9
7 changed files with 783 additions and 23 deletions

View File

@@ -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")
}
}