mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
Add stupid retries in clickhouse-test health check.
This commit is contained in:
parent
ecc6ff707b
commit
e91cdb4f8d
@ -94,7 +94,7 @@ class HTTPError(Exception):
|
|||||||
|
|
||||||
# Helpers to execute queries via HTTP interface.
|
# Helpers to execute queries via HTTP interface.
|
||||||
def clickhouse_execute_http(
|
def clickhouse_execute_http(
|
||||||
base_args, query, timeout=30, settings=None, default_format=None, max_http_retries=5
|
base_args, query, timeout=30, settings=None, default_format=None, max_http_retries=5, retry_error_codes=False
|
||||||
):
|
):
|
||||||
if args.secure:
|
if args.secure:
|
||||||
client = http.client.HTTPSConnection(
|
client = http.client.HTTPSConnection(
|
||||||
@ -131,6 +131,7 @@ def clickhouse_execute_http(
|
|||||||
)
|
)
|
||||||
res = client.getresponse()
|
res = client.getresponse()
|
||||||
data = res.read()
|
data = res.read()
|
||||||
|
if res.status == 200 or (not retry_error_codes):
|
||||||
break
|
break
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if i == max_http_retries - 1:
|
if i == max_http_retries - 1:
|
||||||
@ -143,8 +144,8 @@ def clickhouse_execute_http(
|
|||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def clickhouse_execute(base_args, query, timeout=30, settings=None, max_http_retries=5):
|
def clickhouse_execute(base_args, query, timeout=30, settings=None, max_http_retries=5, retry_error_codes=False):
|
||||||
return clickhouse_execute_http(base_args, query, timeout, settings, max_http_retries=max_http_retries).strip()
|
return clickhouse_execute_http(base_args, query, timeout, settings, max_http_retries=max_http_retries, retry_error_codes=retry_error_codes).strip()
|
||||||
|
|
||||||
|
|
||||||
def clickhouse_execute_json(base_args, query, timeout=60, settings=None, max_http_retries=5):
|
def clickhouse_execute_json(base_args, query, timeout=60, settings=None, max_http_retries=5):
|
||||||
@ -1078,7 +1079,7 @@ class TestCase:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def send_test_name_failed(suite: str, case: str):
|
def send_test_name_failed(suite: str, case: str):
|
||||||
pid = os.getpid()
|
pid = os.getpid()
|
||||||
clickhouse_execute(args, f"SELECT 'Running test {suite}/{case} from pid={pid}'")
|
clickhouse_execute(args, f"SELECT 'Running test {suite}/{case} from pid={pid}'", retry_error_codes=True)
|
||||||
|
|
||||||
def run_single_test(
|
def run_single_test(
|
||||||
self, server_logs_level, client_options
|
self, server_logs_level, client_options
|
||||||
|
Loading…
Reference in New Issue
Block a user