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.

Wait for the server to observe runner disconnect before replay reconnect

rcourtmane1e4c3e7004d
diff --git a/internal/hostagent/operation_receipt_websocket_integration_test.go b/internal/hostagent/operation_receipt_websocket_integration_test.go
index 322f4c2e36..221da7730c 100644
--- a/internal/hostagent/operation_receipt_websocket_integration_test.go
+++ b/internal/hostagent/operation_receipt_websocket_integration_test.go
@@ -308,6 +308,17 @@ func TestRealServerActionRunnerCancellationPersistsAndReplaysProxmoxReceiptAfter
case <-time.After(3 * time.Second):
t.Fatal("action runner did not stop")
}
+ // The client has exited, but the server observes the socket close on
+ // its own reader goroutine. Reconnecting before that lands would let
+ // startRunner see the stale session as "connected" and dispatch the
+ // replay to a dead socket.
+ deadline := time.Now().Add(3 * time.Second)
+ for server.IsAgentConnected(admission.AgentID) && time.Now().Before(deadline) {
+ time.Sleep(10 * time.Millisecond)
+ }
+ if server.IsAgentConnected(admission.AgentID) {
+ t.Fatal("server did not observe the action runner disconnect")
+ }
}
request := agentexec.ProxmoxGuestLifecyclePayload{