9bb4b09a04
CI / Lint + build + test (push) Has been cancelled
Post-repair hardware validation pipeline for Proxmox cluster hosts. Go orchestrator + in-image agent + mkosi live image + bundled dnsmasq PXE + SQLite + HTMX/SSE UI + notify registry + janitor + full docs.
22 lines
532 B
Go
22 lines
532 B
Go
package tests
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
// readFile is used by stages that need to peek at /sys files without
|
|
// importing the agent's probes package (which would cycle).
|
|
func readFile(p string) ([]byte, error) {
|
|
return os.ReadFile(p)
|
|
}
|
|
|
|
// formatCount pluralizes a count + label: (0, "disk") → "0 disks",
|
|
// (1, "disk") → "1 disk", (n, "disk") → "n disks". Keeps log lines tidy.
|
|
func formatCount(n int, label string) string {
|
|
if n == 1 {
|
|
return fmt.Sprintf("%d %s", n, label)
|
|
}
|
|
return fmt.Sprintf("%d %ss", n, label)
|
|
}
|