From 12595048ff81ce891280fc1ea160afc09efe6ecb Mon Sep 17 00:00:00 2001 From: fjetter Date: Thu, 19 May 2022 11:20:22 +0200 Subject: [PATCH] Add regression test for #6320 --- distributed/cli/tests/test_dask_worker.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/distributed/cli/tests/test_dask_worker.py b/distributed/cli/tests/test_dask_worker.py index 23080909e1c..8ff649bde20 100644 --- a/distributed/cli/tests/test_dask_worker.py +++ b/distributed/cli/tests/test_dask_worker.py @@ -682,3 +682,23 @@ def dask_setup(worker): await c.wait_for_workers(1) [foo] = (await c.run(lambda dask_worker: dask_worker.foo)).values() assert foo == "setup" + + +@pytest.mark.parametrize("nanny", ["--nanny", "--no-nanny"]) +def test_error_during_startup(monkeypatch, nanny): + # see https://github.com/dask/distributed/issues/6320 + scheduler_port = 8786 + scheduler_addr = f"tcp://127.0.0.1:{scheduler_port}" + + monkeypatch.setenv("DASK_SCHEDULER_ADDRESS", scheduler_addr) + with popen(["dask-scheduler"]): + with popen( + [ + "dask-worker", + scheduler_addr, + nanny, + "--worker-port", + str(scheduler_port), + ], + ) as worker: + assert worker.wait(5) == 1