fix: complete hardware collection diagnostics
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package collector
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"bee/audit/internal/schema"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParsePSUSDR(t *testing.T) {
|
||||
raw := `
|
||||
@@ -118,3 +121,15 @@ func TestSynthesizePSUsFromSDR(t *testing.T) {
|
||||
t.Fatalf("life used=%v", got[0].LifeUsedPct)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMergePSUSDRAppendsPSUMissingFromFRU(t *testing.T) {
|
||||
model := "PSU0"
|
||||
slot := "0"
|
||||
got := mergePSUSDR([]schema.HardwarePowerSupply{{Slot: &slot, Model: &model}}, map[int]psuSDR{
|
||||
1: {slot: 1, status: statusOK},
|
||||
2: {slot: 2, status: statusOK},
|
||||
})
|
||||
if len(got) != 2 || got[1].Slot == nil || *got[1].Slot != "1" {
|
||||
t.Fatalf("PSUs=%#v, want FRU PSU0 plus synthesized PSU1", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user