From 1eb85e5d8227983eb17fa94aa481652b081aa1a0 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Tue, 26 Nov 2024 09:23:42 +0100 Subject: [PATCH] test parallelism --- .../tests/unit/with_dbs/comp_scheduler/test_worker.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/director-v2/tests/unit/with_dbs/comp_scheduler/test_worker.py b/services/director-v2/tests/unit/with_dbs/comp_scheduler/test_worker.py index 9e56af3d4a02..9c21d769809e 100644 --- a/services/director-v2/tests/unit/with_dbs/comp_scheduler/test_worker.py +++ b/services/director-v2/tests/unit/with_dbs/comp_scheduler/test_worker.py @@ -18,6 +18,9 @@ from pytest_mock import MockerFixture from simcore_service_director_v2.models.comp_runs import RunMetadataDict from simcore_service_director_v2.modules.comp_scheduler._manager import run_new_pipeline +from simcore_service_director_v2.modules.comp_scheduler._models import ( + SchedulePipelineRabbitMessage, +) from simcore_service_director_v2.modules.comp_scheduler._worker import ( _get_scheduler_worker, ) @@ -80,12 +83,16 @@ async def mocked_scheduler_api(mocker: MockerFixture) -> mock.Mock: ) +@pytest.mark.parametrize( + "queue_name", [SchedulePipelineRabbitMessage.get_channel_name()] +) async def test_worker_scheduling_parallelism( with_disabled_auto_scheduling: mock.Mock, mocked_scheduler_api: mock.Mock, initialized_app: FastAPI, publish_project: Callable[[], Awaitable[PublishedProject]], run_metadata: RunMetadataDict, + ensure_parametrized_queue_is_empty: None, ): with_disabled_auto_scheduling.assert_called_once() @@ -94,7 +101,7 @@ async def _side_effect(*args, **kwargs): mocked_scheduler_api.side_effect = _side_effect - async def _project_pipeline_creation_workflow(): + async def _project_pipeline_creation_workflow() -> None: published_project = await publish_project() assert published_project.project.prj_owner await run_new_pipeline(