nvidia: improve component mapping, firmware, statuses and check times
This commit is contained in:
@@ -359,6 +359,12 @@ func TestConvertPCIeDevices(t *testing.T) {
|
||||
|
||||
func TestConvertPCIeDevices_NVSwitchWithoutSerialRemainsEmpty(t *testing.T) {
|
||||
hw := &models.HardwareConfig{
|
||||
Firmware: []models.FirmwareInfo{
|
||||
{
|
||||
DeviceName: "NVSwitch NVSWITCH1 (965-25612-0002-000)",
|
||||
Version: "96.10.6D.00.01",
|
||||
},
|
||||
},
|
||||
PCIeDevices: []models.PCIeDevice{
|
||||
{
|
||||
Slot: "NVSWITCH1",
|
||||
@@ -378,6 +384,9 @@ func TestConvertPCIeDevices_NVSwitchWithoutSerialRemainsEmpty(t *testing.T) {
|
||||
if result[0].SerialNumber != "" {
|
||||
t.Fatalf("expected empty NVSwitch serial, got %q", result[0].SerialNumber)
|
||||
}
|
||||
if result[0].Firmware != "96.10.6D.00.01" {
|
||||
t.Fatalf("expected NVSwitch firmware 96.10.6D.00.01, got %q", result[0].Firmware)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertPCIeDevices_SkipsDisplayControllerDuplicates(t *testing.T) {
|
||||
@@ -646,3 +655,47 @@ func TestConvertToReanimator_DeduplicatesAllSections(t *testing.T) {
|
||||
t.Fatalf("expected single #GPU0 record, got %d", gpuCount)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertToReanimator_FirmwareExcludesDeviceBoundEntries(t *testing.T) {
|
||||
input := &models.AnalysisResult{
|
||||
Filename: "fw-filter-test.json",
|
||||
Hardware: &models.HardwareConfig{
|
||||
BoardInfo: models.BoardInfo{SerialNumber: "BOARD-001"},
|
||||
Firmware: []models.FirmwareInfo{
|
||||
{DeviceName: "BIOS", Version: "1.0.0"},
|
||||
{DeviceName: "BMC", Version: "2.0.0"},
|
||||
{DeviceName: "GPU GPUSXM1 (692-2G520-0280-501)", Version: "96.00.D0.00.03"},
|
||||
{DeviceName: "NVSwitch NVSWITCH0 (965-25612-0002-000)", Version: "96.10.6D.00.01"},
|
||||
{DeviceName: "NIC #CPU1_PCIE9 (MCX512A-ACAT)", Version: "28.38.1900"},
|
||||
{DeviceName: "CPU0 Microcode", Version: "0x2b000643"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
out, err := ConvertToReanimator(input)
|
||||
if err != nil {
|
||||
t.Fatalf("ConvertToReanimator() failed: %v", err)
|
||||
}
|
||||
|
||||
if len(out.Hardware.Firmware) != 2 {
|
||||
t.Fatalf("expected only machine-level firmware entries, got %d", len(out.Hardware.Firmware))
|
||||
}
|
||||
|
||||
got := map[string]string{}
|
||||
for _, fw := range out.Hardware.Firmware {
|
||||
got[fw.DeviceName] = fw.Version
|
||||
}
|
||||
|
||||
if got["BIOS"] != "1.0.0" {
|
||||
t.Fatalf("expected BIOS firmware to be kept")
|
||||
}
|
||||
if got["BMC"] != "2.0.0" {
|
||||
t.Fatalf("expected BMC firmware to be kept")
|
||||
}
|
||||
if _, exists := got["GPU GPUSXM1 (692-2G520-0280-501)"]; exists {
|
||||
t.Fatalf("expected GPU firmware to be excluded from hardware.firmware")
|
||||
}
|
||||
if _, exists := got["NVSwitch NVSWITCH0 (965-25612-0002-000)"]; exists {
|
||||
t.Fatalf("expected NVSwitch firmware to be excluded from hardware.firmware")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user