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(agentexec): isolate registration ordering log probe

pulse-triage[bot]8e977d464f05
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 516b1bdc1a..b8cea596c2 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -8019,3 +8019,9 @@ window deterministically and checks the first wire frame. It joins the handler
before restoring its test logger. Real unified-agent receipt replay tests cover
APT, cleanup and Docker mutation-once behaviour, and Proxmox cancellation/reconnect.
This is synthetic transport proof, not installed delivery or CI qualification.
+
+The deterministic registration-order regression runs its global logging hook in
+an isolated copy of the same test binary. Joining that probe's handler does not
+join upgraded handlers from preceding tests; process isolation keeps their final
+log writes from racing with the hook. The child retains race instrumentation and
+an explicit timeout, and the original server still fails the ordering assertion.
diff --git a/internal/agentexec/server_websocket_test.go b/internal/agentexec/server_websocket_test.go
index c002260215..763eb13e07 100644
--- a/internal/agentexec/server_websocket_test.go
+++ b/internal/agentexec/server_websocket_test.go
@@ -9,6 +9,8 @@ import (
"io"
"net/http"
"net/http/httptest"
+ "os"
+ "os/exec"
"strings"
"testing"
"time"
@@ -2145,6 +2147,19 @@ func TestTypedOperation_TimeoutSendsCancelAndExpiredContextNeverDispatches(t *te
// Probe the scheduling window after publication but before the registration
// acknowledgement. No sleeps or repeated runs are needed to expose this order.
func TestRegistrationReservesFirstFrameBeforePublishingSession(t *testing.T) {
+ // Other tests can leave upgraded HTTP handlers finishing their log writes.
+ // Run the global logging hook in a fresh copy of this same race-instrumented
+ // test binary; joining our own handler alone cannot join those prior tests.
+ if os.Getenv("PULSE_REGISTRATION_ORDER_PROBE") != "1" {
+ ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
+ defer cancel()
+ cmd := exec.CommandContext(ctx, os.Args[0], "-test.run=^TestRegistrationReservesFirstFrameBeforePublishingSession$", "-test.count=1")
+ cmd.Env = append(os.Environ(), "PULSE_REGISTRATION_ORDER_PROBE=1")
+ if output, err := cmd.CombinedOutput(); err != nil {
+ t.Fatalf("isolated registration probe: %v\n%s", err, output)
+ }
+ return
+ }
server := NewServer(allowAllTestTokens)
original := log.Logger
checked := make(chan bool, 1)