Pass ENV into inner docker run

This commit is contained in:
Dmitry Novik 2023-06-20 15:20:21 +02:00
parent 49f88f5873
commit c3e56a5214
2 changed files with 19 additions and 1 deletions

View File

@ -239,6 +239,8 @@ class ClickhouseIntegrationTestsRunner:
self.start_time = time.time()
self.soft_deadline_time = self.start_time + (TASK_TIMEOUT - MAX_TIME_IN_SANDBOX)
self.use_analyzer = os.environ.get("CLICKHOUSE_USE_NEW_ANALYZER") is not None
if "run_by_hash_total" in self.params:
self.run_by_hash_total = self.params["run_by_hash_total"]
self.run_by_hash_num = self.params["run_by_hash_num"]
@ -398,6 +400,9 @@ class ClickhouseIntegrationTestsRunner:
result.append("--tmpfs")
if self.disable_net_host:
result.append("--disable-net-host")
if self.use_analyzer:
result.append("--analyzer")
return " ".join(result)
def _get_all_tests(self, repo_path):

View File

@ -283,6 +283,14 @@ if __name__ == "__main__":
help="Use tmpfs for dockerd files",
)
parser.add_argument(
"--analyzer",
action="store_true",
default=False,
dest="analyzer",
help="Use new analyzer infrastructure",
)
parser.add_argument(
"--cleanup-containers",
action="store_true",
@ -393,6 +401,10 @@ if __name__ == "__main__":
if args.keyword_expression:
args.pytest_args += ["-k", args.keyword_expression]
use_analyzer = ""
if args.analyzer:
use_analyzer = "-e CLICKHOUSE_USE_NEW_ANALYZER=1"
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 \
@ -400,7 +412,7 @@ if __name__ == "__main__":
--volume={src_dir}/Server/grpc_protos:/ClickHouse/src/Server/grpc_protos \
--volume=/run:/run/host:ro \
{dockerd_internal_volume} -e DOCKER_CLIENT_TIMEOUT=300 -e COMPOSE_HTTP_TIMEOUT=600 \
-e XTABLES_LOCKFILE=/run/host/xtables.lock \
-e XTABLES_LOCKFILE=/run/host/xtables.lock {use_analyzer_var}\
-e PYTHONUNBUFFERED=1 \
{env_tags} {env_cleanup} -e PYTEST_OPTS='{parallel} {opts} {tests_list} {rand} -vvv' {img}".format(
net=net,
@ -420,6 +432,7 @@ if __name__ == "__main__":
dockerd_internal_volume=dockerd_internal_volume,
img=DIND_INTEGRATION_TESTS_IMAGE_NAME + ":" + args.docker_image_version,
name=CONTAINER_NAME,
use_analyzer_var=use_analyzer,
)
cmd = cmd_base + " " + args.command