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.

Cover scoped token read failure and distinct instance policy

pulse-triage[bot]ccd1171eced0
diff --git a/internal/monitoring/tenant_runtime_config_test.go b/internal/monitoring/tenant_runtime_config_test.go
index a14357f18e..96c893e309 100644
--- a/internal/monitoring/tenant_runtime_config_test.go
+++ b/internal/monitoring/tenant_runtime_config_test.go
@@ -40,7 +40,7 @@ func TestLoadTenantRuntimeConfigUsesScopedResourcesAndPreservesInstanceSettings(
TLSCertFile: "instance-cert", TLSKeyFile: "instance-key", FrontendPort: 7655,
APITokens: []config.APITokenRecord{{ID: "default-token", Hash: "synthetic-default-hash"}},
PVEInstances: []config.PVEInstance{{Name: "default-node", TokenValue: "synthetic-default-secret"}},
- PublicURL: "https://default.invalid", PVEPollingInterval: 42 * time.Second,
+ PublicURL: "https://default.invalid", PVEPollingInterval: 42 * time.Second, PBSPollingInterval: 71 * time.Second, AllowedOrigins: "https://instance-ui.invalid",
HideLocalLogin: true, Discovery: config.DefaultDiscoveryConfig(),
EnvOverrides: map[string]bool{"PVE_POLLING_INTERVAL": true, "PULSE_AUTH_HIDE_LOCAL_LOGIN": true, "discoveryMaxConcurrent": true},
}
@@ -106,6 +106,12 @@ func TestLoadTenantRuntimeConfigEmptyInventoryDoesNotInheritCredentials(t *testi
if _, err := loadTenantRuntimeConfig(base, nil); err == nil {
t.Error("missing persistence was accepted")
}
+ if err := os.WriteFile(filepath.Join(p.GetConfigDir(), "api_tokens.json"), []byte("{invalid"), 0o600); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := loadTenantRuntimeConfig(base, p); err == nil {
+ t.Error("unreadable scoped credentials fell back to another token inventory")
+ }
}
func TestReloadTenantRejectsDefaultAndRetainsIncompleteStopGuard(t *testing.T) {