add pre-pull to runner

This commit is contained in:
Yatsishin Ilya 2023-01-04 15:47:50 +00:00
parent 4d5131ed7d
commit d8d012523d

View File

@ -242,6 +242,14 @@ if __name__ == "__main__":
"-n", "--parallel", action="store", dest="parallel", help="Parallelism"
)
parser.add_argument(
"--no-random", action="store", dest="no_random", help="Disable tests order randomization"
)
parser.add_argument(
"--pre-pull", action="store_true", default=False, dest="pre_pull", help="Pull images for docker_compose before all other actions"
)
parser.add_argument(
"-t",
"--tests_list",
@ -374,7 +382,7 @@ if __name__ == "__main__":
if args.keyword_expression:
args.pytest_args += ["-k", args.keyword_expression]
cmd = "docker run {net} {tty} --rm --name {name} --privileged \
cmd_base = "docker run {net} {tty} --rm --name {name} --privileged \
--volume={odbc_bridge_bin}:/clickhouse-odbc-bridge --volume={bin}:/clickhouse \
--volume={library_bridge_bin}:/clickhouse-library-bridge \
--volume={base_cfg}:/clickhouse-config --volume={cases_dir}:/ClickHouse/tests/integration \
@ -383,7 +391,7 @@ if __name__ == "__main__":
{dockerd_internal_volume} -e DOCKER_CLIENT_TIMEOUT=300 -e COMPOSE_HTTP_TIMEOUT=600 \
-e XTABLES_LOCKFILE=/run/host/xtables.lock \
-e PYTHONUNBUFFERED=1 \
{env_tags} {env_cleanup} -e PYTEST_OPTS='{parallel} {opts} {tests_list} -vvv' {img} {command}".format(
{env_tags} {env_cleanup} -e PYTEST_OPTS='{parallel} {opts} {tests_list} -vvv' {img}".format(
net=net,
tty=tty,
bin=args.binary,
@ -400,9 +408,11 @@ if __name__ == "__main__":
dockerd_internal_volume=dockerd_internal_volume,
img=DIND_INTEGRATION_TESTS_IMAGE_NAME + ":" + args.docker_image_version,
name=CONTAINER_NAME,
command=args.command,
)
cmd = cmd_base + " " + args.command
cmd_pre_pull = cmd_base + " find /compose -name docker_compose_*.yml -exec docker-compose -f '{}' pull \;"
containers = subprocess.check_output(
f"docker ps --all --quiet --filter name={CONTAINER_NAME} --format={{{{.ID}}}}",
shell=True,
@ -413,5 +423,9 @@ if __name__ == "__main__":
subprocess.check_call(f"docker kill {' '.join(containers)}", shell=True)
print(f"Containers {containers} killed")
if args.pre_pull:
print(("Running pre pull as: '" + cmd_pre_pull + "'."))
subprocess.check_call(cmd_pre_pull, shell=True)
print(("Running pytest container as: '" + cmd + "'."))
subprocess.check_call(cmd, shell=True)