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
+38
View File
@@ -30,3 +30,41 @@ func TestFormatGPULineIgnoresNonGPUSameVendorDevice(t *testing.T) {
t.Fatalf("formatGPULine() = %q, want %q", got, want)
}
}
func TestFormatSATDetail(t *testing.T) {
raw := `run_at_utc=2026-09-12T16:30:00Z
01-cpu_status=OK
storage_status=FAILED
tpm_status=UNSUPPORTED
overall_status=FAILED
job_ok=1
job_failed=1`
got := formatSATDetail(raw)
want := `Run: 2026-09-12T16:30:00Z
PASS cpu
FAIL storage
SKIP tpm
Overall: FAILED (ok=1 failed=1)`
if got != want {
t.Fatalf("formatSATDetail() = %q, want %q", got, want)
}
}
func TestCleanSummaryKey(t *testing.T) {
for _, tt := range []struct {
input string
want string
}{
{input: "01-cpu", want: "cpu"},
{input: "cpu", want: "cpu"},
{input: "cpu-01", want: "cpu-01"},
{input: "-cpu", want: "-cpu"},
} {
if got := cleanSummaryKey(tt.input); got != tt.want {
t.Errorf("cleanSummaryKey(%q) = %q, want %q", tt.input, got, tt.want)
}
}
}