Skip to content

Commit

Permalink
fix incorrect args passed to `apps.webhooks.tasks.trigger_webhook.exe…
Browse files Browse the repository at this point in the history
…cute_webhook` (#4217)

## Which issue(s) this PR closes

fix incorrect args passed to
`apps.webhooks.tasks.trigger_webhook.execute_webhook`

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
  • Loading branch information
joeyorlando committed Apr 12, 2024
1 parent 9009497 commit 28ed2dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion engine/apps/webhooks/tasks/trigger_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ def execute_webhook(webhook_pk, alert_group_id, user_id, escalation_policy_id, t
retry_num = manual_retry_num + 1
logger.warning(f"Manually retrying execute_webhook for {msg_details} manual_retry_num={retry_num}")
execute_webhook.apply_async(
(webhook_pk, alert_group_id, user_id, escalation_policy_id, retry_num),
(webhook_pk, alert_group_id, user_id, escalation_policy_id),
kwargs={"trigger_type": trigger_type, "manual_retry_num": retry_num},
countdown=10,
)
else:
Expand Down
4 changes: 3 additions & 1 deletion engine/apps/webhooks/tests/test_trigger_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,9 @@ def test_manually_retried_exceptions(
execute_webhook(*execute_webhook_args)

mock_requests.post.assert_called_once_with("https://test/", timeout=TIMEOUT, headers={})
spy_execute_webhook.apply_async.assert_called_once_with((*execute_webhook_args, 1), countdown=10)
spy_execute_webhook.apply_async.assert_called_once_with(
execute_webhook_args, kwargs={"trigger_type": None, "manual_retry_num": 1}, countdown=10
)

mock_requests.reset_mock()
spy_execute_webhook.reset_mock()
Expand Down

0 comments on commit 28ed2dd

Please sign in to comment.