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(monitoring): synchronise canonical token host fixture

pulse-triage[bot]05e31eadf03f
diff --git a/internal/monitoring/canonical_guardrails_test.go b/internal/monitoring/canonical_guardrails_test.go
index ac7f80490c..4398e9f8c4 100644
--- a/internal/monitoring/canonical_guardrails_test.go
+++ b/internal/monitoring/canonical_guardrails_test.go
@@ -2683,8 +2683,9 @@ func TestDefaultOrgMonitorSharesCanonicalRuntimeTokenInventory(t *testing.T) {
Scopes: []string{config.ScopeAgentExec},
}}
config.Mu.Unlock()
- monitor.mu.Lock()
- monitor.state.Hosts = []models.Host{{
+ // GetMonitor starts polling concurrently; host fixtures must use the
+ // state-owned lock, not monitor.mu, to synchronise with snapshots.
+ monitor.state.UpsertHost(models.Host{
ID: "agent-fresh-token",
Hostname: "fresh-token-host",
Status: "online",
@@ -2692,8 +2693,7 @@ func TestDefaultOrgMonitorSharesCanonicalRuntimeTokenInventory(t *testing.T) {
AgentVersion: "6.2.2",
TokenID: "fresh-agent-token",
CommandsEnabled: true,
- }}
- monitor.mu.Unlock()
+ })
diagnostics := monitor.GetAgentFleetDiagnostics("6.2.2", now)
agent := requireAgentDiagnostic(t, diagnostics, "agent-agent-fresh-token")