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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
test: Add empty ID test for HandleDockerHostRemoved function
rcourtman5a9e947f78a4
diff --git a/internal/alerts/alerts_test.go b/internal/alerts/alerts_test.goindex 2b1fd939ae..2d4c6123bc 100644--- a/internal/alerts/alerts_test.go+++ b/internal/alerts/alerts_test.go@@ -3540,3 +3540,30 @@ func TestCleanupHostDiskAlerts(t *testing.T) {}})}++func TestHandleDockerHostRemovedEmptyID(t *testing.T) {+ t.Parallel()+ m := NewManager()++ // Create some alerts that should not be touched+ m.mu.Lock()+ m.activeAlerts["docker-host-offline-host1"] = &Alert{ID: "docker-host-offline-host1"}+ m.dockerOfflineCount["host1"] = 3+ m.mu.Unlock()++ // Call with empty ID - should be noop+ host := models.DockerHost{ID: ""}+ m.HandleDockerHostRemoved(host)++ m.mu.RLock()+ _, alertExists := m.activeAlerts["docker-host-offline-host1"]+ _, countExists := m.dockerOfflineCount["host1"]+ m.mu.RUnlock()++ if !alertExists {+ t.Error("expected alert to remain when host ID is empty")+ }+ if !countExists {+ t.Error("expected offline count to remain when host ID is empty")+ }+}