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:
2026-09-10 11:58:33 +03:00
co-authored by Claude Sonnet 5
parent 95f552a0e5
commit 71f4c237fc
2 changed files with 34 additions and 5 deletions
+30
View File
@@ -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{