test(webhooks): add integration test for webhook retry on 500 response (#578)#581
Merged
Chucks1093 merged 1 commit intoJul 19, 2026
Conversation
…slayerorg#578) When a webhook callback URL returns a 500 error, the server should retry delivery with exponential backoff rather than treating it as a permanent failure. This integration test verifies: - A callback returning 500 triggers exactly one retry - The retry fires after the configured backoff delay (2^1 * 1000ms) - On the second attempt (200), the webhook event status is DELIVERED - The webhook is not marked as isFailing after a successful retry
Closed
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #578
Summary
Adds an integration test to verify that the webhook delivery system correctly retries after receiving a 500 Internal Server Error from the callback URL, rather than immediately marking the webhook as failing.
Test Approach
500on the first request and200on all subsequent requests. Request timestamps are recorded.dispatchWebhookEventis called with a buy trade event, triggering delivery to the mock server.500→ the service applies exponential backoff (Math.pow(2, 1) * 1000 = 2000ms)200→ the event is markedDELIVEREDDELIVEREDwithretryCount: 2isFailing: true(only flagged after all retries are exhausted)Acceptance Criteria Met
Files Changed
src/modules/webhooks/webhook.integration.test.ts— Added the new test block with mock HTTP server and assertions