Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend some timeouts in tests #8963

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading