fasttest timeout set by env

This commit is contained in:
Max Kainov 2023-10-31 11:01:49 +00:00
parent b57906609c
commit 9bb7de07e0

View File

@ -36,6 +36,11 @@ from version_helper import get_version_from_repo
NAME = "Fast test"
# Fast tests in most cases done within 10 min and 40 min timout should be sufficient,
# though due to cold cache build time can be much longer
# https://pastila.nl/?146195b6/9bb99293535e3817a9ea82c3f0f7538d.link#5xtClOjkaPLEjSuZ92L2/g==
FASTTEST_TIMEOUT = os.getenv("FASTTEST_TIMEOUT_MIN", 40) * 60
# Will help to avoid errors like _csv.Error: field larger than field limit (131072)
csv.field_size_limit(sys.maxsize)
@ -142,22 +147,8 @@ def main():
run_log_path = logs_path / "run.log"
timeout_expired = False
# Do not increase this timeout
# https://pastila.nl/?146195b6/9bb99293535e3817a9ea82c3f0f7538d.link#5xtClOjkaPLEjSuZ92L2/g==
#
# SELECT toStartOfWeek(started_at) AS hour,
# avg(completed_at - started_at) AS avg_runtime from default.workflow_jobs
# WHERE
# conclusion = 'success' AND
# name = 'FastTest'
# GROUP BY hour
# ORDER BY hour
#
# Our fast tests finish in less than 10 minutes average, and very rarely it builds
# longer, but the next run will reuse the sccache
# SO DO NOT INCREASE IT
timeout = 40 * 60
with TeePopen(run_cmd, run_log_path, timeout=timeout) as process:
with TeePopen(run_cmd, run_log_path, timeout=FASTTEST_TIMEOUT) as process:
retcode = process.wait()
if process.timeout_exceeded:
logging.info("Timeout expired for command: %s", run_cmd)
@ -197,7 +188,7 @@ def main():
state, description, test_results = process_results(output_path)
if timeout_expired:
test_results.append(TestResult.create_check_timeout_expired(timeout))
test_results.append(TestResult.create_check_timeout_expired(FASTTEST_TIMEOUT))
state = "failure"
description = format_description(test_results[-1].name)