test: cover IPMI, PSU, and SAT formatting
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user