From 23bcc8985390cae04dd3ce7bd9a97be7b2ef4ea0 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Tue, 21 Jan 2025 18:48:16 +0300 Subject: [PATCH] Extend some timeouts in tests (#8963) --- tests/python/rest_api/test_webhooks_sender.py | 11 ++++++++--- tests/python/rest_api/utils.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/python/rest_api/test_webhooks_sender.py b/tests/python/rest_api/test_webhooks_sender.py index 5db1b14fe00d..688909654b35 100644 --- a/tests/python/rest_api/test_webhooks_sender.py +++ b/tests/python/rest_api/test_webhooks_sender.py @@ -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 @@ -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 @@ -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 diff --git a/tests/python/rest_api/utils.py b/tests/python/rest_api/utils.py index c314d4263c2a..89db59ebf23c 100644 --- a/tests/python/rest_api/utils.py +++ b/tests/python/rest_api/utils.py @@ -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,