fix(inspur): match main board FRU on word boundary
A bare "board" substring test let compound module names like "FANBOARD0_FRU" qualify as the main system board, overwriting the real board info with fan-board serial/part numbers. Switch to a word-boundary regex. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+30
@@ -32,6 +32,36 @@ func TestExtractBoardInfo_PreservesBuiltinSerial(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractBoardInfo_FanBoardIsNotMainBoard(t *testing.T) {
|
||||
hw := &models.HardwareConfig{}
|
||||
fruList := []models.FRUInfo{
|
||||
{
|
||||
Description: "SCM_FRU (ID 8)",
|
||||
SerialNumber: "CAR517GN0377A01",
|
||||
ProductName: "CA",
|
||||
PartNumber: "YZCA-04672-101",
|
||||
},
|
||||
{
|
||||
Description: "FANBOARD0_FRU (ID 64)",
|
||||
SerialNumber: "CFR517G80024A01",
|
||||
ProductName: "CF",
|
||||
PartNumber: "YZCF-04669-101",
|
||||
},
|
||||
}
|
||||
|
||||
extractBoardInfo(fruList, hw)
|
||||
|
||||
if hw.BoardInfo.ProductName != "CA" {
|
||||
t.Fatalf("expected product name CA, got %q", hw.BoardInfo.ProductName)
|
||||
}
|
||||
if hw.BoardInfo.PartNumber != "YZCA-04672-101" {
|
||||
t.Fatalf("expected part number YZCA-04672-101, got %q", hw.BoardInfo.PartNumber)
|
||||
}
|
||||
if hw.BoardInfo.SerialNumber != "CAR517GN0377A01" {
|
||||
t.Fatalf("expected serial CAR517GN0377A01, got %q", hw.BoardInfo.SerialNumber)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractBoardInfo_DoesNotUsePSUVendorAsBoardManufacturer(t *testing.T) {
|
||||
hw := &models.HardwareConfig{}
|
||||
fruList := []models.FRUInfo{
|
||||
|
||||
Reference in New Issue
Block a user