fix: parse Inspur PCIe CPU affinity
This commit is contained in:
@@ -49,6 +49,27 @@ RESTful fan`
|
||||
if got.Vendor == "" {
|
||||
t.Fatalf("expected NIC vendor resolved from pci.ids")
|
||||
}
|
||||
if got.NUMANode == nil || *got.NUMANode != 0 {
|
||||
t.Fatalf("expected CPU affinity 0, got %v", got.NUMANode)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseComponentLog_AddsPCIeInventoryAndAffinity(t *testing.T) {
|
||||
text := `RESTful PCIE Device info:
|
||||
[{"id":1,"present":1,"vendor_id":6987,"vendor_name":"Marvell","device_id":37424,"device_name":"Marvell 9230 Raid","bus_num":101,"dev_num":0,"func_num":0,"max_link_width":2,"max_link_speed":2,"current_link_width":2,"current_link_speed":2,"location":"#CPU0_PE3_P4_R4_SL1","DeviceLocator":"CPU0_PE3_PCIE4","dev_type":1,"dev_subtype":6}]
|
||||
RESTful Network Adapter info:
|
||||
{"sys_adapters":[]}
|
||||
RESTful fan info:
|
||||
{"fans":[]}`
|
||||
|
||||
hw := &models.HardwareConfig{}
|
||||
ParseComponentLog([]byte(text), hw)
|
||||
if len(hw.PCIeDevices) != 1 {
|
||||
t.Fatalf("expected 1 PCIe device, got %d", len(hw.PCIeDevices))
|
||||
}
|
||||
if got := hw.PCIeDevices[0].NUMANode; got == nil || *got != 0 {
|
||||
t.Fatalf("expected CPU affinity 0, got %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseNetworkAdapterInfo_MergesIntoExistingInventory(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user