From e610a1867c1b6bbd69b92a17b4a542edd4d8b333 Mon Sep 17 00:00:00 2001 From: Alexander Tokmakov Date: Tue, 29 Aug 2023 15:19:13 +0200 Subject: [PATCH] Revert "Fixed wrong python test name pattern" --- tests/integration/ci-runner.py | 53 ++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/tests/integration/ci-runner.py b/tests/integration/ci-runner.py index 5c3a7695119..aa89ccf11b3 100755 --- a/tests/integration/ci-runner.py +++ b/tests/integration/ci-runner.py @@ -9,7 +9,6 @@ import os import random import re import shutil -import string import subprocess import time import shlex @@ -431,12 +430,19 @@ class ClickhouseIntegrationTestsRunner: def _get_all_tests(self, repo_path): image_cmd = self._get_runner_image_cmd(repo_path) - runner_opts = self._get_runner_opts() + out_file = "all_tests.txt" out_file_full = os.path.join(self.result_path, "runner_get_all_tests.log") cmd = ( - f"cd {repo_path}/tests/integration && " - f"timeout --signal=KILL 1h ./runner {runner_opts} {image_cmd} -- --setup-plan " - f"| tee '{out_file_full}'" + "cd {repo_path}/tests/integration && " + "timeout --signal=KILL 1h ./runner {runner_opts} {image_cmd} -- --setup-plan " + "| tee '{out_file_full}' | grep -F '::' | sed -r 's/ \(fixtures used:.*//g; s/^ *//g; s/ *$//g' " + "| grep -v -F 'SKIPPED' | sort --unique > {out_file}".format( + repo_path=repo_path, + runner_opts=self._get_runner_opts(), + image_cmd=image_cmd, + out_file=out_file, + out_file_full=out_file_full, + ) ) logging.info("Getting all tests with cmd '%s'", cmd) @@ -444,19 +450,34 @@ class ClickhouseIntegrationTestsRunner: cmd, shell=True ) - all_tests = set() - with open(out_file_full, "r", encoding="utf-8") as all_tests_fd: - for line in all_tests_fd: - if ( - line[0] in string.whitespace # test names at the start of lines - or "::test" not in line # test names contain '::test' - or "SKIPPED" in line # pytest.mark.skip/-if - ): - continue - all_tests.add(line.strip()) + all_tests_file_path = "{repo_path}/tests/integration/{out_file}".format( + repo_path=repo_path, out_file=out_file + ) + if ( + not os.path.isfile(all_tests_file_path) + or os.path.getsize(all_tests_file_path) == 0 + ): + if os.path.isfile(out_file_full): + # log runner output + logging.info("runner output:") + with open(out_file_full, "r") as all_tests_full_file: + for line in all_tests_full_file: + line = line.rstrip() + if line: + logging.info("runner output: %s", line) + else: + logging.info("runner output '%s' is empty", out_file_full) - assert all_tests + raise Exception( + "There is something wrong with getting all tests list: file '{}' is empty or does not exist.".format( + all_tests_file_path + ) + ) + all_tests = [] + with open(all_tests_file_path, "r") as all_tests_file: + for line in all_tests_file: + all_tests.append(line.strip()) return list(sorted(all_tests)) def _get_parallel_tests_skip_list(self, repo_path):