Skip to content

Commit

Permalink
Fix a non-deterministic webhook test (#7952)
Browse files Browse the repository at this point in the history
`test_two_project_webhooks_intersection` is supposed to trigger each
webhook once. However, the first one of these webhooks actually gets
triggered twice, because creating a task causes the project's
`updated_date` to be bumped, which triggers an `update:project` event.

The test still passes a lot of the time (I guess because the second
delivery doesn't appear immediately?), but sometimes it fails. It's very
easy to make it fail consistently, though - just add a `sleep(5)` before
the `get_deliveries` calls.

Fix this by changing the first webhook's second event to something that
will not be triggered.
  • Loading branch information
SpecLad authored May 29, 2024
1 parent 5359a4e commit 0b2f877
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/python/rest_api/test_webhooks_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def test_two_project_webhooks_intersection(self):
assert response.status_code == HTTPStatus.CREATED

project_id = response.json()["id"]
events_1 = ["create:task", "update:project"]
events_1 = ["create:task", "update:issue"]
events_2 = ["create:task", "create:issue"]
webhook_id_1 = create_webhook(events_1, "project", project_id=project_id)["id"]
webhook_id_2 = create_webhook(events_2, "project", project_id=project_id)["id"]
Expand Down

0 comments on commit 0b2f877

Please sign in to comment.