Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Retain recovery probe error text in phase diagnostics

pulse-triage[bot]dca7cb5700f2
diff --git a/scripts/installtests/agent_id_recovery_unix_test.go b/scripts/installtests/agent_id_recovery_unix_test.go
index 8f532adb34..807e9afcc4 100644
--- a/scripts/installtests/agent_id_recovery_unix_test.go
+++ b/scripts/installtests/agent_id_recovery_unix_test.go
@@ -6,6 +6,7 @@ import (
"bytes"
"context"
"errors"
+ "fmt"
"os"
"os/exec"
"path/filepath"
@@ -39,6 +40,22 @@ type agentIDRecoveryObservation struct {
started bool
}
+func (o agentIDRecoveryObservation) String() string {
+ // fmt does not invoke Error on unexported struct fields. Format the errors
+ // explicitly so a failure retains its actual context/exit, not an address.
+ return fmt.Sprintf("preparation=%s execution=%s start=%s wait=%s started=%t context=%v exit=%v",
+ o.preparation, o.execution, o.start, o.wait, o.started, o.contextErr, o.err)
+}
+
+func TestAgentIDRecoveryObservationRetainsContextAndExit(t *testing.T) {
+ observed := agentIDRecoveryObservation{contextErr: context.DeadlineExceeded, err: os.ErrNotExist}
+ description := fmt.Sprintf("%+v", observed)
+ if !strings.Contains(description, "context=context deadline exceeded") ||
+ !strings.Contains(description, "exit="+os.ErrNotExist.Error()) {
+ t.Fatalf("recovery errors lost their actual diagnostic: %s", description)
+ }
+}
+
// Keep fixture extraction and trace-file setup outside the execution budget.
// Both can take time under the race detector without the recovery shell having
// started. Once the command is ready, the same two seconds cover Bash, every