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.

test(server): prove the startup watchdog names the stalled phase

pulse-triage[bot]1ba7f8bdcdef
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index 202821728a..512b7b5501 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -939,6 +939,15 @@ tokens, and path-normalization variants.
closure plus replacement-deployment or verified-retirement evidence at the
required tier. Keep optional history rewriting separate and nonblocking
after containment.
+16. Keep startup-stall diagnostics inside the local process boundary. A stalled
+ startup may write the last completed startup phase and a full goroutine
+ stack to the local process log so a bound-but-not-serving listener is
+ diagnosable in the field. Goroutine stacks are local log output only: they
+ must never enter the outbound telemetry payload, a service-health event, or
+ any provider-bound request, and the diagnostic must not expose request
+ bodies, credentials, or governed resource detail beyond what the local
+ operator already holds. Regression coverage:
+ `TestStartupWatchdogLogsPhaseAndStack` in `pkg/server/service_health_test.go`.
## Current State
diff --git a/pkg/server/service_health_test.go b/pkg/server/service_health_test.go
index 364069c267..5f33e0aaf2 100644
--- a/pkg/server/service_health_test.go
+++ b/pkg/server/service_health_test.go
@@ -1,13 +1,16 @@
package server
import (
+ "bytes"
"fmt"
"net"
"net/http"
+ "strings"
"testing"
"time"
"github.com/rcourtman/pulse-go-rewrite/internal/telemetry"
+ "github.com/rs/zerolog"
)
func TestServiceHealthProbeCoversAPIUIAndFrontendAssets(t *testing.T) {
@@ -114,3 +117,32 @@ func TestFrontendAssetPathsStayLocalAndBounded(t *testing.T) {
t.Fatalf("frontend asset paths = %#v", got)
}
}
+
+// A bound-but-not-serving listener is otherwise undiagnosable: nothing accepts
+// connections and no startup log line is emitted while a synchronous step
+// stalls. The watchdog must name the last completed phase and dump the local
+// goroutine stacks so a recurrence can be read from the field log.
+func TestStartupWatchdogLogsPhaseAndStack(t *testing.T) {
+ var buf bytes.Buffer
+ phase := &startupPhase{}
+ phase.mark("config watcher started")
+
+ stop := startStartupWatchdog(zerolog.New(&buf), phase, 20*time.Millisecond)
+ defer stop()
+
+ deadline := time.Now().Add(2 * time.Second)
+ for time.Now().Before(deadline) && !strings.Contains(buf.String(), "startup is stalled") {
+ time.Sleep(5 * time.Millisecond)
+ }
+
+ logged := buf.String()
+ if !strings.Contains(logged, "startup is stalled") {
+ t.Fatalf("startup watchdog did not fire: %q", logged)
+ }
+ if !strings.Contains(logged, "config watcher started") {
+ t.Fatalf("startup watchdog did not name the last completed phase: %q", logged)
+ }
+ if !strings.Contains(logged, "goroutine") {
+ t.Fatalf("startup watchdog did not include a local goroutine stack: %q", logged)
+ }
+}