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 DNS resolution failure test for ValidateWebhookURL

rcourtman87a184137b5b
diff --git a/internal/notifications/webhook_allowlist_test.go b/internal/notifications/webhook_allowlist_test.go
index 9b83601013..f39369ab09 100644
--- a/internal/notifications/webhook_allowlist_test.go
+++ b/internal/notifications/webhook_allowlist_test.go
@@ -287,3 +287,16 @@ func TestValidateWebhookURLWithAllowlist(t *testing.T) {
t.Error("Expected error for link-local even with allowlist")
}
}
+
+func TestValidateWebhookURL_DNSResolutionFailure(t *testing.T) {
+ nm := NewNotificationManager("")
+
+ // Use a hostname that will definitely not resolve
+ err := nm.ValidateWebhookURL("http://this-hostname-definitely-does-not-exist-12345.invalid/webhook")
+ if err == nil {
+ t.Error("Expected error for unresolvable hostname")
+ }
+ if !strings.Contains(err.Error(), "failed to resolve webhook hostname") {
+ t.Errorf("Expected DNS resolution error, got: %v", err)
+ }
+}