Skip to content

Commit

Permalink
Extend some timeouts in tests (#8963)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiltsov-max authored Jan 21, 2025
1 parent 02719a2 commit 23bcc89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions tests/python/rest_api/test_webhooks_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import json
from http import HTTPStatus
from time import sleep
from time import sleep, time

import pytest
from deepdiff import DeepDiff
Expand Down Expand Up @@ -65,9 +65,11 @@ def create_webhook(events, webhook_type, project_id=None, org_id=""):
return response.json()


def get_deliveries(webhook_id, expected_count=1):
def get_deliveries(webhook_id, expected_count=1, *, timeout: int = 60):
start_time = time()

delivery_response = {}
for _ in range(10):
while True:
response = get_method("admin1", f"webhooks/{webhook_id}/deliveries")
assert response.status_code == HTTPStatus.OK

Expand All @@ -76,6 +78,9 @@ def get_deliveries(webhook_id, expected_count=1):
delivery_response = json.loads(deliveries["results"][0]["response"])
break

if time() - start_time > timeout:
raise TimeoutError("Failed to get deliveries within the specified time interval")

sleep(1)

return deliveries, delivery_response
Expand Down
2 changes: 1 addition & 1 deletion tests/python/rest_api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def export_dataset(
], # make this parameter required to be sure that all tests was updated and both API versions are used
*,
save_images: bool,
max_retries: int = 50,
max_retries: int = 300,
interval: float = 0.1,
format: str = "CVAT for images 1.1", # pylint: disable=redefined-builtin
**kwargs,
Expand Down

0 comments on commit 23bcc89

Please sign in to comment.