Revert "Revert "Fixed wrong python test name pattern""

This commit is contained in:
Mikhail f. Shiryaev 2023-08-29 18:58:56 +02:00 committed by Mikhail f. Shiryaev
parent d5ffff93a7
commit b610faf685
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4

View File

@ -9,6 +9,7 @@ import os
import random
import re
import shutil
import string
import subprocess
import time
import shlex
@ -430,19 +431,12 @@ class ClickhouseIntegrationTestsRunner:
def _get_all_tests(self, repo_path):
image_cmd = self._get_runner_image_cmd(repo_path)
out_file = "all_tests.txt"
runner_opts = self._get_runner_opts()
out_file_full = os.path.join(self.result_path, "runner_get_all_tests.log")
cmd = (
"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,
)
f"cd {repo_path}/tests/integration && "
f"timeout --signal=KILL 1h ./runner {runner_opts} {image_cmd} -- --setup-plan "
f"| tee '{out_file_full}'"
)
logging.info("Getting all tests with cmd '%s'", cmd)
@ -450,34 +444,19 @@ class ClickhouseIntegrationTestsRunner:
cmd, shell=True
)
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)
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())
raise Exception(
"There is something wrong with getting all tests list: file '{}' is empty or does not exist.".format(
all_tests_file_path
)
)
assert all_tests
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):