mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-10 10:35:51 +00:00
1cf92e6c10
Adds TestContract_MetadataGetPayloadsUseZeroRecordsInsteadOf404: empty
guest/docker metadata maps must serialize as {} (never null) and a
missing resource must return a 200 zero record echoing the requested ID
(never a 404). This is the proof companion to the
metadata_handlers_shared.go consolidation in the previous commit — it
was authored with that change but lost to a shared-index race at commit
time.
25 lines
549 B
Go
25 lines
549 B
Go
package notifications
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestSendWebhookRequestRevalidatesURL(t *testing.T) {
|
|
nm := NewNotificationManager("")
|
|
defer nm.Stop()
|
|
|
|
webhook := WebhookConfig{
|
|
Name: "blocked",
|
|
URL: "http://127.0.0.1/webhook",
|
|
}
|
|
|
|
err := nm.sendWebhookRequest(webhook, []byte(`{}`), "alert", "test-alert:alert")
|
|
if err == nil {
|
|
t.Fatalf("expected validation error for localhost webhook URL")
|
|
}
|
|
if !strings.Contains(err.Error(), "webhook URL validation failed") {
|
|
t.Fatalf("expected validation error, got %v", err)
|
|
}
|
|
}
|