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: fix TestLoad_Errors to provide valid encryption key

rcourtmanf2be9b60f0d2
diff --git a/internal/config/config_load_extra_test.go b/internal/config/config_load_extra_test.go
index 23230e14e9..8c976253de 100644
--- a/internal/config/config_load_extra_test.go
+++ b/internal/config/config_load_extra_test.go
@@ -1,6 +1,7 @@
package config
import (
+ "encoding/base64"
"os"
"path/filepath"
"testing"
@@ -56,6 +57,16 @@ func TestLoad_Errors(t *testing.T) {
tempDir := t.TempDir()
t.Setenv("PULSE_DATA_DIR", tempDir)
+ // First create encryption key so crypto doesn't fail when it sees .enc files
+ // Key must be base64-encoded 32-byte value
+ keyPath := filepath.Join(tempDir, ".encryption.key")
+ key := make([]byte, 32)
+ for i := range key {
+ key[i] = byte(i) // Non-zero key
+ }
+ encoded := base64.StdEncoding.EncodeToString(key)
+ require.NoError(t, os.WriteFile(keyPath, []byte(encoded), 0600))
+
// 1. Corrupted Nodes
nodesPath := filepath.Join(tempDir, "nodes.enc")
require.NoError(t, os.WriteFile(nodesPath, []byte("corrupted"), 0644))