Skip to content

Commit

Permalink
fix test_dashboard_port_zero test
Browse files Browse the repository at this point in the history
  • Loading branch information
fjetter committed Mar 4, 2022
1 parent e782f66 commit c37485c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions distributed/cli/tests/test_dask_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
pytest.importorskip("requests")

import os
import re
import shutil
import sys
import tempfile
Expand All @@ -21,6 +22,7 @@
from distributed.metrics import time
from distributed.utils import get_ip, get_ip_interface
from distributed.utils_test import (
_TEST_TIMEOUT,
assert_can_connect_from_everywhere_4_6,
assert_can_connect_locally_4,
popen,
Expand Down Expand Up @@ -218,13 +220,14 @@ def test_scheduler_port_zero(loop):
def test_dashboard_port_zero(loop):
pytest.importorskip("bokeh")
with popen(["dask-scheduler", "--dashboard-address", ":0"]) as proc:
count = 0
while count < 1:
pattern = re.compile(r".*dashboard at:\s+:(\d)+$")
start = time()
while time() - start < _TEST_TIMEOUT:
line = proc.stderr.readline()
if b"dashboard" in line.lower():
sleep(0.01)
count += 1
assert b":0" not in line
m = pattern.match(line.decode())
if m:
assert m.group(0) != "0"
return


PRELOAD_TEXT = """
Expand Down

0 comments on commit c37485c

Please sign in to comment.