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.

fix(test): add stateFileDir to TestRun_Legacy test setup

rcourtmana383f0684842
diff --git a/internal/hostagent/proxmox_setup_test.go b/internal/hostagent/proxmox_setup_test.go
index 3e958a3b03..54afcb6a70 100644
--- a/internal/hostagent/proxmox_setup_test.go
+++ b/internal/hostagent/proxmox_setup_test.go
@@ -727,10 +727,20 @@ func TestRun_Legacy(t *testing.T) {
// Setup temporary state dir
tmpDir := t.TempDir()
- // Backup
+ // Backup and restore all state-related variables
+ origStateFileDir := stateFileDir
origStateFilePath := stateFilePath
+ origStateFilePVE := stateFilePVE
+
+ stateFileDir = tmpDir
stateFilePath = filepath.Join(tmpDir, "proxmox-registered")
- defer func() { stateFilePath = origStateFilePath }()
+ stateFilePVE = filepath.Join(tmpDir, "proxmox-pve-registered")
+
+ defer func() {
+ stateFileDir = origStateFileDir
+ stateFilePath = origStateFilePath
+ stateFilePVE = origStateFilePVE
+ }()
origLookPath := lookPath
defer func() { lookPath = origLookPath }()