fix: complete hardware collection diagnostics

This commit is contained in:
2026-08-25 17:04:33 +03:00
parent 33ace33de5
commit ccc781856e
19 changed files with 311 additions and 81 deletions
+16 -1
View File
@@ -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)
}
}