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.

Keep independent guest-response fixtures out of retained cooldowns

pulse-triage[bot]3844a230f071
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index 8cc91199b9..465eadfb5e 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -47,6 +47,13 @@ or native/installed acceptance. It neither attributes nor resolves a reported
PBS, Windows guest, restart or workload-safety incident.
+The invalid-QGA-success matrix uses a distinct synthetic base path for each
+case/reader, so OS reuse of a closed ephemeral listener cannot borrow a previous
+fixture's live cooldown. `TestGuestAgentInvalidSuccessFixtureIsolation` shares
+one listener deliberately and checks two independent first admissions and both
+retained second-client fences. No production key, alias, TTL or guard state is
+changed or cleared to qualify these tests.
+
### Proxmox recovery sessions honour the owning caller
PVE/PBS context-aware constructors bind initial password login, including the
diff --git a/pkg/proxmox/guest_agent_success_response_test.go b/pkg/proxmox/guest_agent_success_response_test.go
index 205f3fa674..9bc23bafdc 100644
--- a/pkg/proxmox/guest_agent_success_response_test.go
+++ b/pkg/proxmox/guest_agent_success_response_test.go
@@ -55,14 +55,19 @@ func TestGuestAgentInvalidSuccessDefersEveryRead(t *testing.T) {
}
}))
defer server.Close()
- c := backupTestClient(t, server.URL)
+ // A closed httptest listener's ephemeral port can be reused by
+ // another case while its real uncertainty fence is still live.
+ // Give independent synthetic guests distinct base paths, while
+ // every client within this case keeps exactly the same key.
+ host := invalidSuccessFixtureEndpoint(server.URL, name, reader)
+ c := backupTestClient(t, host)
if err := first(context.Background(), c, 105); GuestAgentDeferredReason(err) != "agent-completion-unverified" {
t.Errorf("unverified success released admission: %v", err)
}
before := configs.Load()
// The next complete reply would be healthy; it must not be
// requested while the earlier command remains uncertain.
- diagnostic := backupTestClient(t, server.URL)
+ diagnostic := backupTestClient(t, host)
for later, read := range backupAgentReads() {
if err := read(context.Background(), diagnostic, 105); GuestAgentDeferredReason(err) != "agent-cooldown" {
t.Errorf("next %s escaped cooldown: %v", later, err)
@@ -81,6 +86,49 @@ func TestGuestAgentInvalidSuccessDefersEveryRead(t *testing.T) {
}
}
+func invalidSuccessFixtureEndpoint(serverURL, caseName, reader string) string {
+ return serverURL + "/invalid-success-fixture/" + caseName + "/" + reader
+}
+
+// Deliberately share one listener across two independent fixtures, rather than
+// waiting for the OS to recycle an ephemeral port. No guard entry is cleared,
+// expired or weakened: each new fixture admits its own first command, and its
+// second client sees the same live uncertainty fence.
+func TestGuestAgentInvalidSuccessFixtureIsolation(t *testing.T) {
+ var commands, configs atomic.Int32
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if strings.HasSuffix(r.URL.Path, "/config") {
+ configs.Add(1)
+ fmt.Fprint(w, `{"data":{}}`)
+ return
+ }
+ commands.Add(1)
+ fmt.Fprint(w, `{"Data":null,"data":{"result":[]}}`)
+ }))
+ defer server.Close()
+ for _, name := range []string{"first", "second"} {
+ host := invalidSuccessFixtureEndpoint(server.URL, name, "network")
+ if _, err := backupTestClient(t, host).GetVMNetworkInterfaces(context.Background(), "node", 105); GuestAgentDeferredReason(err) != "agent-completion-unverified" {
+ t.Fatalf("independent fixture did not admit its first uncertain reply: %v", err)
+ }
+ if _, err := backupTestClient(t, host).GetVMFSInfo(context.Background(), "node", 105); GuestAgentDeferredReason(err) != "agent-cooldown" {
+ t.Fatalf("same-fixture second client lost its uncertainty fence: %v", err)
+ }
+ }
+ if commands.Load() != 2 || configs.Load() != 2 {
+ t.Fatalf("independent fixture command/config counts=%d/%d, want 2/2", commands.Load(), configs.Load())
+ }
+ // Both original fences must survive admission of the other fixture.
+ for _, name := range []string{"first", "second"} {
+ if _, err := backupTestClient(t, invalidSuccessFixtureEndpoint(server.URL, name, "network")).GetVMFSInfo(context.Background(), "node", 105); GuestAgentDeferredReason(err) != "agent-cooldown" {
+ t.Fatalf("another fixture erased the original fence: %v", err)
+ }
+ }
+ if commands.Load() != 2 || configs.Load() != 2 {
+ t.Fatal("checking retained fences sent follow-up guest commands or lock reads")
+ }
+}
+
func TestGuestAgentInvalidSuccessSharesAliasesAndResumes(t *testing.T) {
var calls, otherCalls atomic.Int32
var healthy atomic.Bool