Skip to content

Commit 56d75ad

Browse files
committed
Show that setting worker ports fails now
1 parent a282d79 commit 56d75ad

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

parsl/addresses.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,12 @@ def get_any_address() -> str:
161161

162162
def tcp_url(address: str, port: Union[str, int, None] = None) -> str:
163163
"""Construct a tcp url safe for IPv4 and IPv6"""
164+
port_suffix = f":{port}" if port else ""
164165
if address == "*":
165-
return "tcp://*"
166+
return "tcp://*" + port_suffix
166167

167168
ip_addr = ipaddress.ip_address(address)
168169

169-
port_suffix = f":{port}" if port else ""
170-
171170
if ip_addr.version == 6 and port_suffix:
172171
url = f"tcp://[{address}]{port_suffix}"
173172
else:

parsl/tests/test_htex/test_zmq_binding.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212
from parsl.executors.high_throughput.manager_selector import RandomManagerSelector
1313

1414

15-
def make_interchange(*, interchange_address: Optional[str], cert_dir: Optional[str]) -> Interchange:
15+
def make_interchange(*,
16+
interchange_address: Optional[str],
17+
cert_dir: Optional[str],
18+
worker_ports: Optional[tuple[int, int]] = None) -> Interchange:
1619
return Interchange(interchange_address=interchange_address,
1720
cert_dir=cert_dir,
1821
client_address="127.0.0.1",
1922
client_ports=(50055, 50056, 50057),
20-
worker_ports=None,
23+
worker_ports=worker_ports,
2124
worker_port_range=(54000, 55000),
2225
hub_address=None,
2326
hub_zmq_port=None,
@@ -105,3 +108,10 @@ def test_limited_interface_binding(cert_dir: Optional[str]):
105108
assert len(matched_conns) == 1
106109
# laddr.ip can return ::ffff:127.0.0.1 when using IPv6
107110
assert address in matched_conns[0].laddr.ip
111+
112+
113+
@pytest.mark.local
114+
@pytest.mark.parametrize("encrypted", (True, False), indirect=True)
115+
def test_fixed_ports(cert_dir: Optional[str]):
116+
ix = make_interchange(interchange_address=None, cert_dir=cert_dir, worker_ports=(51117, 51118))
117+
assert ix.interchange_address == "*"

0 commit comments

Comments
 (0)