Skip to content

Commit 897ca66

Browse files
author
Andrei Neagu
committed
fast cancellation of lrt
1 parent df8636a commit 897ca66

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from datetime import timedelta
2+
3+
import pytest
4+
from pytest_mock import MockerFixture
5+
6+
7+
@pytest.fixture
8+
async def fast_long_running_tasks_cancellation(
9+
mocker: MockerFixture,
10+
) -> None:
11+
mocker.patch(
12+
"servicelib.long_running_tasks.task._CANCEL_TASKS_CHECK_INTERVAL",
13+
new=timedelta(seconds=1),
14+
)

packages/service-library/tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"pytest_simcore.environment_configs",
2727
"pytest_simcore.file_extra",
2828
"pytest_simcore.logging",
29+
"pytest_simcore.long_running_tasks",
2930
"pytest_simcore.pytest_global_environs",
3031
"pytest_simcore.rabbit_service",
3132
"pytest_simcore.redis_service",

packages/service-library/tests/long_running_tasks/conftest.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import pytest
88
from faker import Faker
9-
from pytest_mock import MockerFixture
109
from servicelib.logging_utils import log_catch
1110
from servicelib.long_running_tasks.task import (
1211
RedisNamespace,
@@ -18,19 +17,9 @@
1817
_logger = logging.getLogger(__name__)
1918

2019

21-
@pytest.fixture
22-
async def mock_cancel_tasks_check_interval(
23-
mocker: MockerFixture,
24-
) -> None:
25-
mocker.patch(
26-
"servicelib.long_running_tasks.task._CANCEL_TASKS_CHECK_INTERVAL",
27-
new=timedelta(seconds=TEST_CHECK_STALE_INTERVAL_S),
28-
)
29-
30-
3120
@pytest.fixture
3221
async def get_tasks_manager(
33-
mock_cancel_tasks_check_interval: None, faker: Faker
22+
fast_long_running_tasks_cancellation: None, faker: Faker
3423
) -> AsyncIterator[
3524
Callable[[RedisSettings, RedisNamespace | None], Awaitable[TasksManager]]
3625
]:

services/dynamic-sidecar/tests/conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"pytest_simcore.docker_swarm",
4343
"pytest_simcore.faker_users_data",
4444
"pytest_simcore.logging",
45+
"pytest_simcore.long_running_tasks",
4546
"pytest_simcore.minio_service",
4647
"pytest_simcore.postgres_service",
4748
"pytest_simcore.pytest_global_environs",
@@ -169,6 +170,7 @@ def mock_rabbit_check(mocker: MockerFixture) -> None:
169170

170171
@pytest.fixture
171172
def base_mock_envs(
173+
fast_long_running_tasks_cancellation: None,
172174
use_in_memory_redis: RedisSettings,
173175
dy_volumes: Path,
174176
shared_store_dir: Path,
@@ -211,6 +213,7 @@ def base_mock_envs(
211213

212214
@pytest.fixture
213215
def mock_environment(
216+
fast_long_running_tasks_cancellation: None,
214217
use_in_memory_redis: RedisSettings,
215218
mock_storage_check: None,
216219
mock_postgres_check: None,

0 commit comments

Comments
 (0)