diff options
| author | Ibrahim Konsowa <imkonsowa@gmail.com> | 2025-07-15 21:49:37 +0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-15 10:49:37 -0700 |
| commit | d78aa3d2de1a18c9802f72c926efa8e80ff2fa64 (patch) | |
| tree | 7980858236682e2cdb3f91f6ed3f9eeaf4843b47 /weed/notification/webhook/http_test.go | |
| parent | 74f4e9ba5ab691938e89b32017a89359ae49428f (diff) | |
| download | seaweedfs-d78aa3d2de1a18c9802f72c926efa8e80ff2fa64.tar.xz seaweedfs-d78aa3d2de1a18c9802f72c926efa8e80ff2fa64.zip | |
[Notifications] Improving webhook notifications (#6965)
* worker setup
* fix tests
* start worker
* graceful worker drain
* retry queue
* migrate queue to watermill
* adding filters and improvements
* add the event type to the webhook message
* eliminating redundant JSON serialization
* resolve review comments
* trigger actions
* fix tests
* typo fixes
* read max_backoff_seconds from config
* add more context to the dead letter
* close the http response on errors
* drain the http response body in case not empty
* eliminate exported typesπ
Diffstat (limited to 'weed/notification/webhook/http_test.go')
| -rw-r--r-- | weed/notification/webhook/http_test.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/weed/notification/webhook/http_test.go b/weed/notification/webhook/http_test.go index 5a008d2a5..f7ef006ae 100644 --- a/weed/notification/webhook/http_test.go +++ b/weed/notification/webhook/http_test.go @@ -48,7 +48,7 @@ func TestHttpClientSendMessage(t *testing.T) { }, } - err = client.sendMessage("/test/path", message) + err = client.sendMessage(newWebhookMessage("/test/path", message)) if err != nil { t.Fatalf("Failed to send message: %v", err) } @@ -57,6 +57,10 @@ func TestHttpClientSendMessage(t *testing.T) { t.Errorf("Expected key '/test/path', got %v", receivedPayload["key"]) } + if receivedPayload["event_type"] != "create" { + t.Errorf("Expected event_type 'create', got %v", receivedPayload["event_type"]) + } + if receivedPayload["message"] == nil { t.Error("Expected message to be present") } @@ -92,7 +96,7 @@ func TestHttpClientSendMessageWithoutToken(t *testing.T) { message := &filer_pb.EventNotification{} - err = client.sendMessage("/test/path", message) + err = client.sendMessage(newWebhookMessage("/test/path", message)) if err != nil { t.Fatalf("Failed to send message: %v", err) } @@ -120,7 +124,7 @@ func TestHttpClientSendMessageServerError(t *testing.T) { message := &filer_pb.EventNotification{} - err = client.sendMessage("/test/path", message) + err = client.sendMessage(newWebhookMessage("/test/path", message)) if err == nil { t.Error("Expected error for server error response") } @@ -139,7 +143,7 @@ func TestHttpClientSendMessageNetworkError(t *testing.T) { message := &filer_pb.EventNotification{} - err = client.sendMessage("/test/path", message) + err = client.sendMessage(newWebhookMessage("/test/path", message)) if err == nil { t.Error("Expected error for network failure") } |
