File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
services/web/server/tests/unit/with_dbs/01 Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1010from http .client import HTTPException
1111
1212import pytest
13+ import tenacity
1314from aiohttp .test_utils import TestClient
1415from faker import Faker
1516from models_library .products import ProductName
2829)
2930from simcore_service_webserver .application_settings import GarbageCollectorSettings
3031from simcore_service_webserver .db .models import UserRole
32+ from tenacity import retry_if_exception_type , stop_after_attempt , wait_fixed
3133
3234
3335@pytest .fixture
@@ -245,5 +247,10 @@ async def test_prune_expired_api_keys_task_is_triggered(
245247 APP_SETTINGS_KEY
246248 ].WEBSERVER_GARBAGE_COLLECTOR
247249 assert isinstance (settings , GarbageCollectorSettings )
248- await asyncio .sleep (2 * settings .GARBAGE_COLLECTOR_PRUNE_APIKEYS_INTERVAL_S )
249- mock .assert_called ()
250+ async for attempt in tenacity .AsyncRetrying (
251+ stop = stop_after_attempt (5 ),
252+ wait = wait_fixed (1 ),
253+ retry = retry_if_exception_type (AssertionError ),
254+ ):
255+ with attempt :
256+ mock .assert_called ()
You can’t perform that action at this time.
0 commit comments