clickhouse-test: early exit if server died (more than 20 queries failed in chain). Auto use system queries dir.

This commit is contained in:
proller 2018-01-12 16:56:02 +03:00
parent 1c06c0f810
commit bf2fb5f2cc

View File

@ -114,6 +114,7 @@ def main(args):
print("\nRunning {} tests.\n".format(suite)) print("\nRunning {} tests.\n".format(suite))
failures = 0 failures = 0
failures_chain = 0
if 'stateful' in suite and not is_data_present(): if 'stateful' in suite and not is_data_present():
print("Won't run stateful tests because test data wasn't loaded. See README.txt.") print("Won't run stateful tests because test data wasn't loaded. See README.txt.")
continue continue
@ -208,6 +209,7 @@ def main(args):
report_testcase.append(stdout_element) report_testcase.append(stdout_element)
failures = failures + 1 failures = failures + 1
failures_chain = failures_chain + 1
print("{0} - return code {1}".format(MSG_FAIL, proc.returncode)) print("{0} - return code {1}".format(MSG_FAIL, proc.returncode))
if stderr: if stderr:
@ -228,6 +230,7 @@ def main(args):
report_testcase.append(stderr_element) report_testcase.append(stderr_element)
failures = failures + 1 failures = failures + 1
failures_chain = failures_chain + 1
print("{0} - having stderror:\n{1}".format(MSG_FAIL, stderr.encode('utf-8'))) print("{0} - having stderror:\n{1}".format(MSG_FAIL, stderr.encode('utf-8')))
elif 'Exception' in stdout: elif 'Exception' in stdout:
failure = et.Element("error", attrib = {"message": "having exception"}) failure = et.Element("error", attrib = {"message": "having exception"})
@ -238,6 +241,7 @@ def main(args):
report_testcase.append(stdout_element) report_testcase.append(stdout_element)
failures = failures + 1 failures = failures + 1
failures_chain = failures_chain + 1
print("{0} - having exception:\n{1}".format(MSG_FAIL, stdout.encode('utf-8'))) print("{0} - having exception:\n{1}".format(MSG_FAIL, stdout.encode('utf-8')))
elif not os.path.isfile(reference_file): elif not os.path.isfile(reference_file):
skipped = et.Element("skipped", attrib = {"message": "no reference file"}) skipped = et.Element("skipped", attrib = {"message": "no reference file"})
@ -268,6 +272,7 @@ def main(args):
os.remove(stdout_file) os.remove(stdout_file)
if os.path.exists(stderr_file): if os.path.exists(stderr_file):
os.remove(stderr_file) os.remove(stderr_file)
failures_chain = 0
except KeyboardInterrupt as e: except KeyboardInterrupt as e:
print(colored("Break tests execution", "red")) print(colored("Break tests execution", "red"))
raise e raise e
@ -281,6 +286,9 @@ def main(args):
finally: finally:
dump_report(args.output, suite, name, report_testcase) dump_report(args.output, suite, name, report_testcase)
if failures_chain >= 20:
break
failures_total = failures_total + failures failures_total = failures_total + failures
if failures_total > 0: if failures_total > 0:
@ -293,8 +301,8 @@ def main(args):
if __name__ == '__main__': if __name__ == '__main__':
parser = ArgumentParser(description = 'ClickHouse functional tests') parser = ArgumentParser(description = 'ClickHouse functional tests')
parser.add_argument('-q', '--queries', default = 'queries', help = 'Path to queries dir') parser.add_argument('-q', '--queries', help = 'Path to queries dir')
parser.add_argument('--tmp', default = 'queries', help = 'Path to tmp dir') parser.add_argument('--tmp', help = 'Path to tmp dir')
parser.add_argument('-b', '--binary', default = 'clickhouse', help = 'Main clickhouse binary') parser.add_argument('-b', '--binary', default = 'clickhouse', help = 'Main clickhouse binary')
parser.add_argument('-c', '--client', help = 'Client program') parser.add_argument('-c', '--client', help = 'Client program')
parser.add_argument('--clientconfig', help = 'Client config (if you use not default ports)') parser.add_argument('--clientconfig', help = 'Client config (if you use not default ports)')
@ -314,6 +322,16 @@ if __name__ == '__main__':
group.add_argument('--no-shard', action = 'store_false', default = None, dest = 'shard', help = 'Do not run shard related tests') group.add_argument('--no-shard', action = 'store_false', default = None, dest = 'shard', help = 'Do not run shard related tests')
args = parser.parse_args() args = parser.parse_args()
if args.queries is None and os.path.isdir('queries'):
args.queries = 'queries'
if args.tmp is None:
args.tmp = args.queries
else:
args.queries = '/usr/share/clickhouse-test/queries'
if args.tmp is None:
args.tmp = '/tmp/clickhouse-test'
if args.client is None: if args.client is None:
args.client = args.binary + '-client' args.client = args.binary + '-client'
if args.clientconfig: if args.clientconfig: