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 PULSE_DATA_DIR to TestMainCmd

rcourtman3b70e29b87b5
diff --git a/cmd/pulse/commands_test.go b/cmd/pulse/commands_test.go
index 246aaa1158..3c39617639 100644
--- a/cmd/pulse/commands_test.go
+++ b/cmd/pulse/commands_test.go
@@ -631,6 +631,9 @@ func TestRunServer_ConfigReload(t *testing.T) {
cancel()
err := <-errChan
assert.NoError(t, err)
+
+ // Give time for any pending file watcher events to complete before cleanup
+ time.Sleep(100 * time.Millisecond)
}
func TestMainCmd(t *testing.T) {
@@ -639,6 +642,11 @@ func TestMainCmd(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
defer cancel()
+ tempDir := t.TempDir()
+ t.Setenv("PULSE_DATA_DIR", tempDir)
+ createTestEncryptionKey(t, tempDir)
+ os.WriteFile(filepath.Join(tempDir, "nodes.enc"), []byte("data"), 0644)
+
// Override rootCmd RunE
oldRunE := rootCmd.RunE
rootCmd.RunE = func(cmd *cobra.Command, args []string) error {