f66472fd37
Extends orca doctor with two new checks (REQ-052): - doctor os: re-runs OS detection from /etc/os-release, compares to stored localhost node's os field. Drift = WARN (re-run orca init); match = PASS; missing localhost node = FAIL. - doctor proxmox: iterates kind=proxmox nodes, SSH-probes each with `pveversion` (3s timeout per node, clones Network() pattern). Zero proxmox nodes = WARN; reachable = PASS; unreachable = FAIL. Changes: - internal/osdetect: new shared package (Detect + ParseID) extracted from internal/cli to avoid import cycle (cli + doctor both need it) - internal/cli/osdetect.go: thin wrapper delegating to osdetect package - internal/doctor/doctor.go: OS() and Proxmox() checks; All() extended; probeProxmoxPVEVersion uses orca SSH key + knownhosts TOFU - internal/cli/doctor.go: doctor os + doctor proxmox subcommands (--json) - internal/doctor/doctor_test.go: 5 new tests (OS match/drift/missing, proxmox no-nodes/unreachable) E2E: orca init -> orca doctor shows 6 PASS / 1 WARN (proxmox=none) / 1 FAIL (network=daemon not running). doctor os --json valid. ---ci--- project: orca phase: 3 milestone: v0.6 status: execute ---/ci---
20 lines
533 B
Go
20 lines
533 B
Go
package cli
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
// The osdetect parsing/detection logic is tested in
|
|
// internal/osdetect/osdetect_test.go. These tests verify the cli
|
|
// wrapper delegates correctly.
|
|
|
|
func TestDetectOS_DelegatesToPackage(t *testing.T) {
|
|
// On this host (Ubuntu), detectOS should return "ubuntu" via the
|
|
// osdetect package. If /etc/os-release is absent (e.g., in a
|
|
// minimal container), it returns "linux".
|
|
result := detectOS()
|
|
if result == "" {
|
|
t.Error("detectOS returned empty string, expected a non-empty OS ID")
|
|
}
|
|
}
|