From d1d3e451bb9a9ce09cb8e6ae5df0d073a757c3a0 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Mon, 8 May 2023 11:52:35 +0200 Subject: [PATCH] add wait for new task --- packages/pytest-simcore/src/pytest_simcore/docker_swarm.py | 6 +++--- .../migration/tests/integration/test_migration_service.py | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/pytest-simcore/src/pytest_simcore/docker_swarm.py b/packages/pytest-simcore/src/pytest_simcore/docker_swarm.py index b915726d9d52..0e7a178f9ed4 100644 --- a/packages/pytest-simcore/src/pytest_simcore/docker_swarm.py +++ b/packages/pytest-simcore/src/pytest_simcore/docker_swarm.py @@ -183,7 +183,7 @@ def docker_swarm( retry=retry_if_exception_type(AssertionError), stop=stop_after_delay(30), ) -def _wait_for_new_task(service, old_task_ids: set[str]) -> None: +def _wait_for_new_task_to_be_started(service: Any, old_task_ids: set[str]) -> None: service.reload() new_task_ids = {t["ID"] for t in service.tasks()} assert len(new_task_ids.difference(old_task_ids)) == 1 @@ -198,9 +198,9 @@ def _force_restart_migration_service(docker_client: docker.client.DockerClient) print( "WARNING: migration service detected before updating stack, it will be force-updated" ) - current_task_ids = {t["ID"] for t in migration_service.tasks()} + before_update_task_ids = {t["ID"] for t in migration_service.tasks()} migration_service.force_update() - _wait_for_new_task(migration_service, current_task_ids) + _wait_for_new_task_to_be_started(migration_service, before_update_task_ids) print(f"forced updated {migration_service.name}.") diff --git a/services/migration/tests/integration/test_migration_service.py b/services/migration/tests/integration/test_migration_service.py index 628538e23655..f32746c1d195 100644 --- a/services/migration/tests/integration/test_migration_service.py +++ b/services/migration/tests/integration/test_migration_service.py @@ -1,3 +1,7 @@ +# pylint:disable=unused-variable +# pylint:disable=unused-argument +# pylint:disable=redefined-outer-name + pytest_simcore_core_services_selection = ["postgres", "migration"] pytest_simcore_ops_services_selection = [ "adminer",