test: cover IPMI, PSU, and SAT formatting

This commit is contained in:
2026-09-12 16:36:07 +03:00
parent 9da6dac1bd
commit cfef94870f
6 changed files with 309 additions and 2 deletions
+24
View File
@@ -66,6 +66,30 @@ func TestParseBIOSFirmware_empty(t *testing.T) {
}
}
func TestParseBMCFirmwareRevision(t *testing.T) {
tests := []struct {
name string
out string
want string
}{
{
name: "value with surrounding whitespace",
out: "Device ID : 32\nFirmware Revision : 2.14\n",
want: "2.14",
},
{name: "field missing", out: "Device ID : 32\n", want: ""},
{name: "malformed line", out: "Firmware Revision 2.14\n", want: ""},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := parseBMCFirmwareRevision(tt.out); got != tt.want {
t.Fatalf("parseBMCFirmwareRevision() = %q, want %q", got, tt.want)
}
})
}
}
func TestCleanDMIValue(t *testing.T) {
tests := []struct {
input string