Skip to content

Commit c7b9919

Browse files
committed
test raised exception in log monitoring
1 parent 0d6cfc4 commit c7b9919

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

services/dask-sidecar/tests/unit/test_computational_sidecar_tasks.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,9 @@ async def test_run_computational_sidecar_dask_does_not_lose_messages_with_pubsub
811811

812812

813813
@pytest.mark.parametrize(
814-
"integration_version, boot_mode", [("1.0.0", BootMode.CPU)], indirect=True
814+
"integration_version, boot_mode, task_owner",
815+
[("1.0.0", BootMode.CPU, "no_parent_node")],
816+
indirect=True,
815817
)
816818
def test_failing_service_raises_exception(
817819
caplog_info_level: pytest.LogCaptureFixture,
@@ -825,7 +827,9 @@ def test_failing_service_raises_exception(
825827

826828

827829
@pytest.mark.parametrize(
828-
"integration_version, boot_mode", [("1.0.0", BootMode.CPU)], indirect=True
830+
"integration_version, boot_mode, task_owner",
831+
[("1.0.0", BootMode.CPU, "no_parent_node")],
832+
indirect=True,
829833
)
830834
def test_running_service_that_generates_unexpected_data_raises_exception(
831835
caplog_info_level: pytest.LogCaptureFixture,
@@ -840,7 +844,9 @@ def test_running_service_that_generates_unexpected_data_raises_exception(
840844

841845

842846
@pytest.mark.parametrize(
843-
"integration_version, boot_mode", [("1.0.0", BootMode.CPU)], indirect=True
847+
"integration_version, boot_mode, task_owner",
848+
[("1.0.0", BootMode.CPU, "no_parent_node")],
849+
indirect=True,
844850
)
845851
def test_running_service_with_incorrect_zip_data_that_uses_a_file_to_key_map_raises_exception(
846852
caplog_info_level: pytest.LogCaptureFixture,
@@ -855,7 +861,9 @@ def test_running_service_with_incorrect_zip_data_that_uses_a_file_to_key_map_rai
855861

856862

857863
@pytest.mark.parametrize(
858-
"integration_version, boot_mode", [("1.0.0", BootMode.CPU)], indirect=True
864+
"integration_version, boot_mode, task_owner",
865+
[("1.0.0", BootMode.CPU, "no_parent_node")],
866+
indirect=True,
859867
)
860868
def test_delayed_logging_with_small_timeout_raises_exception(
861869
app_environment: EnvVarsDict,
@@ -892,7 +900,9 @@ def test_delayed_logging_with_small_timeout_raises_exception(
892900

893901

894902
@pytest.mark.parametrize(
895-
"integration_version, boot_mode", [("1.0.0", BootMode.CPU)], indirect=True
903+
"integration_version, boot_mode, task_owner",
904+
[("1.0.0", BootMode.CPU, "no_parent_node")],
905+
indirect=True,
896906
)
897907
def test_run_sidecar_with_managed_monitor_container_log_task_raising(
898908
app_environment: EnvVarsDict,
@@ -901,11 +911,8 @@ def test_run_sidecar_with_managed_monitor_container_log_task_raising(
901911
mocked_get_image_labels: mock.Mock,
902912
mocker: MockerFixture,
903913
):
904-
"""https://github.com/aio-libs/aiodocker/issues/901"""
905-
# Mock the timeout with a very small value
906-
907914
mocker.patch(
908-
"simcore_service_dask_sidecar.computational_sidecar.docker_utils.managed_monitor_container_log_task",
915+
"simcore_service_dask_sidecar.computational_sidecar.core.managed_monitor_container_log_task",
909916
side_effect=RuntimeError("Simulated log monitoring failure"),
910917
)
911918

@@ -919,5 +926,5 @@ def test_run_sidecar_with_managed_monitor_container_log_task_raising(
919926
)
920927

921928
# Execute the task and expect a timeout exception in the logs
922-
run_computational_sidecar(**waiting_task.sidecar_params())
923-
pytest.fail("TODO: check that the generic error is raised")
929+
with pytest.raises(RuntimeError, match="Simulated log monitoring failure"):
930+
run_computational_sidecar(**waiting_task.sidecar_params())

0 commit comments

Comments
 (0)