Download inside runner

This commit is contained in:
Yatsishin Ilya 2023-01-02 16:46:24 +00:00
parent 631c55e379
commit 9ab5cf7d62

View File

@ -160,24 +160,6 @@ def get_test_times(output):
return result return result
def pre_pull_images():
images = ["clickhouse/integration-test"]
for image in images:
for i in range(5):
logging.info("Pulling %s image before running tests. Attempt %s", image, i)
try:
subprocess.check_output(
"docker pull %s".format(image),
shell=True,
)
except subprocess.CalledProcessError as err:
logging.info("docker pull failed: " + str(err))
continue
logging.error("Pulling %s failed for 5 attempts. Will fail the worker.", image)
exit(1)
def clear_ip_tables_and_restart_daemons(): def clear_ip_tables_and_restart_daemons():
logging.info( logging.info(
"Dump iptables after run %s", "Dump iptables after run %s",
@ -311,6 +293,30 @@ class ClickhouseIntegrationTestsRunner:
"clickhouse/postgresql-java-client", "clickhouse/postgresql-java-client",
] ]
def _pre_pull_images():
cmd = (
"cd {repo_path}/tests/integration && "
"timeout -s 9 1h ./runner {runner_opts} {image_cmd} {command} ".format(
repo_path=repo_path,
runner_opts=self._get_runner_opts(),
image_cmd=image_cmd,
command=r""" find /compose -name 'docker_compose_*.yml' -exec docker-compose -f '{}' pull \; """
)
)
for i in range(5):
logging.info("Pulling images before running tests. Attempt %s", image, i)
try:
subprocess.check_output(
cmd,
shell=True,
)
except subprocess.CalledProcessError as err:
logging.info("docker-compose pull failed: " + str(err))
return
logging.error("Pulling %s failed for 5 attempts. Will fail the worker.", image)
exit(1)
def _can_run_with(self, path, opt): def _can_run_with(self, path, opt):
with open(path, "r") as script: with open(path, "r") as script:
for line in script: for line in script:
@ -1000,6 +1006,9 @@ if __name__ == "__main__":
params = json.loads(open(params_path, "r").read()) params = json.loads(open(params_path, "r").read())
runner = ClickhouseIntegrationTestsRunner(result_path, params) runner = ClickhouseIntegrationTestsRunner(result_path, params)
logging.info("Pulling images")
runner._pre_pull_images()
logging.info("Running tests") logging.info("Running tests")
# Avoid overlaps with previous runs # Avoid overlaps with previous runs