mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
The test creates 10 consecutive interactive client connections via `uclient.client`, each spawning bash + clickhouse-client. Under ASan with heavy system load, the 10-second hardcoded timeout for the bash shell prompt was too tight, causing `ExpectTimeoutError`. Two fixes: - Increase the bash shell prompt timeout in `uclient.py` from 10s to 60s. This only affects the maximum wait for failures - normal bash startup still takes <1 second. - Add `process.wait()` in `uexpect.IO.close` to properly reap zombie processes between client connections, preventing resource accumulation across the 10 consecutive create/destroy cycles. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96847&sha=3325178d93d3d2248f37ddc8a277f331aa329657&name_0=PR&name_1=Integration%20tests%20%28amd_asan%2C%20db%20disk%2C%20old%20analyzer%2C%201%2F6%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
import os
|
|
import sys
|
|
import time
|
|
|
|
CURDIR = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
sys.path.insert(0, os.path.join(CURDIR))
|
|
|
|
from . import uexpect
|
|
|
|
prompt = ":\\) "
|
|
end_of_block = r".*\r\n.*\r\n"
|
|
|
|
|
|
class client(object):
|
|
def __init__(self, command=None, name="", log=None):
|
|
self.client = uexpect.spawn(["/bin/bash", "--noediting"])
|
|
if command is None:
|
|
command = "/usr/bin/clickhouse-client"
|
|
self.client.command = command
|
|
self.client.eol("\r")
|
|
self.client.logger(log, prefix=name)
|
|
self.client.timeout(20)
|
|
self.client.expect("[#\\$] ", timeout=60)
|
|
self.client.send(command)
|
|
|
|
def __enter__(self):
|
|
return self.client.__enter__()
|
|
|
|
def __exit__(self, type, value, traceback):
|
|
self.client.reader["kill_event"].set()
|
|
# send Ctrl-C
|
|
self.client.send("\x03", eol="")
|
|
time.sleep(0.3)
|
|
self.client.send("quit", eol="\r")
|
|
self.client.send("\x03", eol="")
|
|
return self.client.__exit__(type, value, traceback)
|