Skip to content
Snippets Groups Projects
Commit 8752aef7 authored by Yaroslav Dynnikov's avatar Yaroslav Dynnikov Committed by Yaroslav Dynnikov
Browse files

address review comments 2

parent e130d4f7
No related branches found
No related tags found
1 merge request!112fix: test running on macos
Pipeline #5004 passed
......@@ -306,6 +306,7 @@ class Cluster:
data_dir: str
base_host: str
base_port: int
max_port: int
instances: list[Instance] = field(default_factory=list)
def __repr__(self):
......@@ -341,6 +342,7 @@ class Cluster:
peers=peers or [f"{self.base_host}:{self.base_port + 1}"],
)
assert self.base_port <= instance.port <= self.max_port
self.instances.append(instance)
if wait_ready:
......@@ -379,15 +381,21 @@ def binary_path(compile) -> str:
@pytest.fixture
def cluster(binary_path, tmpdir, worker_id) -> Generator[Cluster, None, None]:
base_port = 3300 + 100 * xdist_worker_number(worker_id)
assert isinstance(base_port, int)
assert 3300 <= base_port <= 65535
n = xdist_worker_number(worker_id)
assert isinstance(n, int)
assert n >= 0
# Provide each worker a dedicated pool of 100 listening ports
base_port = 3300 + n * 100
max_port = base_port + 99
assert max_port <= 65535
cluster = Cluster(
binary_path=binary_path,
data_dir=tmpdir,
base_host="127.0.0.1",
base_port=base_port,
max_port=max_port,
)
yield cluster
cluster.terminate()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment