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.

712 B
Raw Blame
package config

import (
	"os"
	"path/filepath"
	"testing"
)

func TestNewConfigPersistenceFailsWhenEncryptedDataPresentWithoutKey(t *testing.T) {
	dir := t.TempDir()

	// Ensure the crypto migration path can't pick up a real on-disk legacy key.
	t.Setenv("PULSE_LEGACY_KEY_PATH", filepath.Join(t.TempDir(), ".encryption.key"))

	// Simulate existing encrypted data without providing the encryption key.
	if err := os.WriteFile(filepath.Join(dir, "nodes.enc"), []byte("ciphertext"), 0600); err != nil {
		t.Fatalf("failed to write simulated encrypted file: %v", err)
	}

	if _, err := newConfigPersistence(dir); err == nil {
		t.Fatalf("expected error when initializing persistence without encryption key")
	}
}