Skip to content

Commit adbfb8b

Browse files
committed
fix(cluster_scripts): adjust port allocation to avoid overlap
Adjusted the base port allocation to start from 23000 instead of 32000 to ensure it does not overlap with the ephemeral port range, which is usually 32768 to 60999. This change helps in preventing potential port conflicts.
1 parent 573b72e commit adbfb8b

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ Tests execution can be configured using env variables.
9898
* `BOOTSTRAP_DIR` – path to a bootstrap dir for the given testnet (genesis files, config files, faucet data) (default: unset)
9999
* `KEEP_CLUSTERS_RUNNING` – don't stop cluster instances after testrun is finished
100100
(WARNING: this implies interactive behavior when running tests using the `./.github/regression.sh` script)
101+
* `PORTS_BASE` - base port number for ports range used by cluster instances (default: 23000)
101102
102103
When running tests using the `./.github/regression.sh` script, you can also use
103104

cardano_node_tests/utils/cluster_scripts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def get_instance_ports(self, instance_num: int) -> InstancePorts:
169169
# Allocate 100 ports per each 15 pools
170170
ports_per_instance = ((self.num_pools - 1) // 15 + 1) * 100
171171
offset = instance_num * ports_per_instance
172-
base = 32000 + offset
172+
base = configuration.PORTS_BASE + offset
173173
last_port = base + ports_per_instance - 1
174174
ports_per_node = 5
175175

cardano_node_tests/utils/configuration.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ def _check_cardano_node_socket_path() -> None:
3131
DBSYNC_DB = "dbsync"
3232
IS_XDIST = bool(os.environ.get("PYTEST_XDIST_TESTRUNUID"))
3333

34+
# Make sure the ports don't overlap with ephemeral port range. It's usually 32768 to 60999.
35+
# See `cat /proc/sys/net/ipv4/ip_local_port_range`.
36+
PORTS_BASE = int(os.environ.get("PORTS_BASE") or 23000)
37+
3438
# Used also in startup scripts as `if [ -n "$VAR" ]...`
3539
ENABLE_LEGACY = (os.environ.get("ENABLE_LEGACY") or "") != ""
3640
# Used also in startup scripts as `if [ -n "$VAR" ]...`

0 commit comments

Comments
 (0)