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: add regression tests for missing frontend fields

rcourtman4cd3e53c3e50
diff --git a/internal/models/converters_test.go b/internal/models/converters_test.go
index e077137695..c9d52833c0 100644
--- a/internal/models/converters_test.go
+++ b/internal/models/converters_test.go
@@ -114,14 +114,15 @@ func TestNodeToFrontend(t *testing.T) {
Total: 500000000000,
Used: 250000000000,
},
- Uptime: 86400,
- LoadAverage: []float64{0.5, 0.7, 0.9},
- KernelVersion: "5.15.0",
- PVEVersion: "7.4-3",
- LastSeen: now,
- ConnectionHealth: "connected",
- IsClusterMember: true,
- ClusterName: "pve-cluster",
+ Uptime: 86400,
+ LoadAverage: []float64{0.5, 0.7, 0.9},
+ KernelVersion: "5.15.0",
+ PVEVersion: "7.4-3",
+ LastSeen: now,
+ ConnectionHealth: "connected",
+ IsClusterMember: true,
+ ClusterName: "pve-cluster",
+ LinkedHostAgentID: "agent-123",
}
frontend := node.ToFrontend()
@@ -159,6 +160,9 @@ func TestNodeToFrontend(t *testing.T) {
if len(frontend.LoadAverage) != 3 {
t.Errorf("LoadAverage length = %d, want 3", len(frontend.LoadAverage))
}
+ if frontend.LinkedHostAgentId != node.LinkedHostAgentID {
+ t.Errorf("LinkedHostAgentId = %q, want %q", frontend.LinkedHostAgentId, node.LinkedHostAgentID)
+ }
}
func TestNodeToFrontend_EmptyDisplayName(t *testing.T) {
@@ -1076,6 +1080,9 @@ func TestHostToFrontend(t *testing.T) {
Sensors: HostSensorSummary{
TemperatureCelsius: map[string]float64{"cpu": 55.0},
},
+ CommandsEnabled: true,
+ IsLegacy: false,
+ LinkedNodeID: "node-abc",
}
frontend := host.ToFrontend()
@@ -1119,6 +1126,15 @@ func TestHostToFrontend(t *testing.T) {
if frontend.Sensors == nil {
t.Error("Sensors should not be nil")
}
+ if frontend.CommandsEnabled != host.CommandsEnabled {
+ t.Errorf("CommandsEnabled = %v, want %v", frontend.CommandsEnabled, host.CommandsEnabled)
+ }
+ if frontend.IsLegacy != host.IsLegacy {
+ t.Errorf("IsLegacy = %v, want %v", frontend.IsLegacy, host.IsLegacy)
+ }
+ if frontend.LinkedNodeId != host.LinkedNodeID {
+ t.Errorf("LinkedNodeId = %q, want %q", frontend.LinkedNodeId, host.LinkedNodeID)
+ }
if frontend.TokenLastUsedAt == nil || *frontend.TokenLastUsedAt != tokenLastUsed.Unix()*1000 {
t.Errorf("TokenLastUsedAt = %v, want %d", frontend.TokenLastUsedAt, tokenLastUsed.Unix()*1000)
}
diff --git a/pkg/proxmox/cluster_client_test.go b/pkg/proxmox/cluster_client_test.go
index 5daf67ae43..2c43801809 100644
--- a/pkg/proxmox/cluster_client_test.go
+++ b/pkg/proxmox/cluster_client_test.go
@@ -266,7 +266,7 @@ func TestSanitizeEndpointError(t *testing.T) {
{"context deadline basic", "context deadline exceeded", "Request timed out - Proxmox API may be slow or waiting on unreachable backend services"},
{"context deadline storage", "Get /api2/json/nodes/delly/storage: context deadline exceeded", "Request timed out - storage API slow (check for unreachable PBS/NFS/Ceph backends)"},
{"context deadline pbs", "pbs-backup context deadline exceeded", "Request timed out - PBS storage backend unreachable"},
- {"context deadline port 8007", "Can't connect to verdeclose:8007 context deadline exceeded", "Request timed out - PBS storage backend unreachable"},
+ {"context deadline port 8007", "Can't connect to tower:8007 context deadline exceeded", "Request timed out - PBS storage backend unreachable"},
// Client timeout
{"client timeout", "Client.Timeout exceeded while awaiting headers", "Connection timed out - Proxmox API not responding in time"},
// Connection refused
@@ -281,7 +281,7 @@ func TestSanitizeEndpointError(t *testing.T) {
{"403 error", "status 403: Forbidden", "Authentication failed - check API token or credentials"},
{"authentication keyword", "authentication failed: invalid token", "Authentication failed - check API token or credentials"},
// PBS specific
- {"pbs connect error", "Can't connect to verdeclose:8007 (Connection timed out)", "PBS storage unreachable - check Proxmox Backup Server connectivity"},
+ {"pbs connect error", "Can't connect to tower:8007 (Connection timed out)", "PBS storage unreachable - check Proxmox Backup Server connectivity"},
}
for _, tt := range tests {
diff --git a/scripts/watch-agents.sh b/scripts/watch-agents.sh
index 0e7fa7dff7..f5ed140ac8 100755
--- a/scripts/watch-agents.sh
+++ b/scripts/watch-agents.sh
@@ -9,7 +9,7 @@ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
DEPLOY_SCRIPT="$SCRIPT_DIR/dev-deploy-agent.sh"
# Hosts to sync to (edit this list as needed)
-HOSTS=("verdeclose" "minipc" "delly" "pimox")
+HOSTS=("tower")
# Colors
GREEN='\033[0;32m'