Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
test(hostagent): stop the standby tests reading the runner's own disks
rcourtman2d801e20f32a
diff --git a/internal/hostagent/collector_observability_test.go b/internal/hostagent/collector_observability_test.goindex ca43cbd6be..7a528a8e84 100644--- a/internal/hostagent/collector_observability_test.go+++ b/internal/hostagent/collector_observability_test.go@@ -118,6 +118,14 @@ func TestCollectDeviceSMART_LogsStructuredContextWhenDeviceInStandby(t *testing.execLookPath = origLook})+ // Same host-sysfs leak as TestCollectDeviceSMARTStandby: the -n standby+ // guard, and therefore the standby meaning of exit status 3, depends on+ // the probed disk not being a confirmed SSD. Pin it to rotational instead+ // of reading the runner's own /sys/block/sda/queue/rotational.+ stubLinuxSysfs(t, []string{"sda"}, map[string]string{+ "/sys/block/sda/queue/rotational": "1\n",+ })+execLookPath = func(string) (string, error) { return "smartctl", nil }smartRunCommandOutput = func(ctx context.Context, name string, args ...string) ([]byte, error) {return exec.CommandContext(ctx, "sh", "-c", "exit 3").Output()diff --git a/internal/hostagent/smartctl_coverage_test.go b/internal/hostagent/smartctl_coverage_test.goindex 4d868c69c8..82e45099f4 100644--- a/internal/hostagent/smartctl_coverage_test.go+++ b/internal/hostagent/smartctl_coverage_test.go@@ -584,6 +584,16 @@ func TestCollectDeviceSMARTStandby(t *testing.T) {timeNow = origNow})+ // smartctlArgs only sends the -n standby guard for disks that are not+ // confirmed SSDs, and exit status 3 only means standby when that guard+ // was sent. Without a stubbed sysfs this reads the *runner's* real+ // /sys/block/sda/queue/rotational, so the case under test evaporates on+ // any Linux host whose own /dev/sda is an SSD. Pin the probed disk to+ // rotational so the guard is always in play.+ stubLinuxSysfs(t, []string{"sda"}, map[string]string{+ "/sys/block/sda/queue/rotational": "1\n",+ })+fixed := time.Date(2024, 2, 3, 4, 5, 6, 0, time.UTC)timeNow = func() time.Time { return fixed }execLookPath = func(string) (string, error) { return "smartctl", nil }