Skip to content

Commit 9657329

Browse files

File tree

2 files changed

+35
-26
lines changed

2 files changed

+35
-26
lines changed

tests/integration/helpers/keeper_utils.py

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,9 @@ def send_4lw_cmd(cluster, node, cmd="ruok", port=9181):
282282
NOT_SERVING_REQUESTS_ERROR_MSG = "This instance is not currently serving requests"
283283

284284

285-
def wait_until_connected(cluster, node, port=9181, timeout=30.0):
285+
def wait_until_connected(
286+
cluster, node, port=9181, timeout=30.0, wait_complete_readiness=True
287+
):
286288
start = time.time()
287289

288290
logging.debug(
@@ -299,31 +301,34 @@ def wait_until_connected(cluster, node, port=9181, timeout=30.0):
299301
f"{timeout}s timeout while waiting for {node.name} to start serving requests"
300302
)
301303

302-
host = cluster.get_instance_ip(node.name)
303-
logging.debug(
304-
"Waiting until keeper can create sessions on %s:%d (timeout=%f)",
305-
host,
306-
port,
307-
timeout,
308-
)
309-
while True:
310-
zk_cli = None
311-
try:
312-
time_passed = min(time.time() - start, 5.0)
313-
if time_passed >= timeout:
314-
raise Exception(
315-
f"{timeout}s timeout while waiting for {node.name} to start serving requests"
304+
if wait_complete_readiness:
305+
host = cluster.get_instance_ip(node.name)
306+
logging.debug(
307+
"Waiting until keeper can create sessions on %s:%d (timeout=%f)",
308+
host,
309+
port,
310+
timeout,
311+
)
312+
while True:
313+
zk_cli = None
314+
try:
315+
time_passed = min(time.time() - start, 5.0)
316+
if time_passed >= timeout:
317+
raise Exception(
318+
f"{timeout}s timeout while waiting for {node.name} to start serving requests"
319+
)
320+
zk_cli = KazooClient(
321+
hosts=f"{host}:9181", timeout=timeout - time_passed
316322
)
317-
zk_cli = KazooClient(hosts=f"{host}:9181", timeout=timeout - time_passed)
318-
zk_cli.start()
319-
zk_cli.get("/keeper/api_version")
320-
break
321-
except (ConnectionLoss, OperationTimeoutError, KazooTimeoutError):
322-
pass
323-
finally:
324-
if zk_cli:
325-
zk_cli.stop()
326-
zk_cli.close()
323+
zk_cli.start()
324+
zk_cli.get("/keeper/api_version")
325+
break
326+
except (ConnectionLoss, OperationTimeoutError, KazooTimeoutError):
327+
pass
328+
finally:
329+
if zk_cli:
330+
zk_cli.stop()
331+
zk_cli.close()
327332

328333

329334
def wait_until_quorum_lost(cluster, node, port=9181):

tests/integration/test_keeper_disks/test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ def setup_storage(cluster, node, storage_config, cleanup_disks):
9191
storage_config,
9292
)
9393
node.start_clickhouse()
94-
keeper_utils.wait_until_connected(cluster, node)
94+
# complete readiness checks that the sessions can be established,
95+
# but it creates sesssion for this, which will create one more record in log,
96+
# but this test is very strict on number of entries in the log,
97+
# so let's avoid this extra check and rely on retry policy
98+
keeper_utils.wait_until_connected(cluster, node, wait_complete_readiness=False)
9599

96100

97101
def setup_local_storage(cluster, node):

0 commit comments

Comments
 (0)