From 762ffa1454891aed1b728d966d8771b30e089608 Mon Sep 17 00:00:00 2001 From: alesapin Date: Thu, 23 Aug 2018 18:31:20 +0300 Subject: [PATCH 1/2] CLICKHOUSE-3894: Small impovements in integration tests framework --- dbms/tests/integration/helpers/client.py | 8 +++++++- dbms/tests/integration/helpers/cluster.py | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/dbms/tests/integration/helpers/client.py b/dbms/tests/integration/helpers/client.py index 3324a9c8ba3..f5853f8ee8c 100644 --- a/dbms/tests/integration/helpers/client.py +++ b/dbms/tests/integration/helpers/client.py @@ -2,13 +2,19 @@ import errno import subprocess as sp from threading import Timer import tempfile +import os class Client: def __init__(self, host, port=9000, command='/usr/bin/clickhouse-client'): self.host = host self.port = port - self.command = [command, '--host', self.host, '--port', str(self.port), '--stacktrace'] + self.command = [command] + + if os.path.basename(command) == 'clickhouse': + self.command.append('client') + + self.command += ['--host', self.host, '--port', str(self.port), '--stacktrace'] def query(self, sql, stdin=None, timeout=None, settings=None, user=None, ignore_error=False): diff --git a/dbms/tests/integration/helpers/cluster.py b/dbms/tests/integration/helpers/cluster.py index 3aeca080aab..3c3f4912c40 100644 --- a/dbms/tests/integration/helpers/cluster.py +++ b/dbms/tests/integration/helpers/cluster.py @@ -40,7 +40,7 @@ class ClickHouseCluster: """ def __init__(self, base_path, name=None, base_configs_dir=None, server_bin_path=None, client_bin_path=None, - zookeeper_config_path=None): + zookeeper_config_path=None, custom_dockerd_host=None): self.base_dir = p.dirname(base_path) self.name = name if name is not None else '' @@ -54,7 +54,13 @@ class ClickHouseCluster: self.project_name = re.sub(r'[^a-z0-9]', '', self.project_name.lower()) self.instances_dir = p.join(self.base_dir, '_instances' + ('' if not self.name else '_' + self.name)) - self.base_cmd = ['docker-compose', '--project-directory', self.base_dir, '--project-name', self.project_name] + custom_dockerd_host = custom_dockerd_host or os.environ.get('CLICKHOUSE_TESTS_DOCKERD_HOST', '') + + self.base_cmd = ['docker-compose'] + if custom_dockerd_host: + self.base_cmd += ['--host', custom_dockerd_host] + + self.base_cmd += ['--project-directory', self.base_dir, '--project-name', self.project_name] self.base_zookeeper_cmd = None self.base_mysql_cmd = [] self.base_kafka_cmd = [] From aae696730417d3e88ee5ff9a04c4db0dbabf7446 Mon Sep 17 00:00:00 2001 From: alesapin Date: Thu, 23 Aug 2018 18:38:25 +0300 Subject: [PATCH 2/2] CLICKHOUSE-3894: Remove default from get --- dbms/tests/integration/helpers/cluster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbms/tests/integration/helpers/cluster.py b/dbms/tests/integration/helpers/cluster.py index 3c3f4912c40..873bd5c740e 100644 --- a/dbms/tests/integration/helpers/cluster.py +++ b/dbms/tests/integration/helpers/cluster.py @@ -54,7 +54,7 @@ class ClickHouseCluster: self.project_name = re.sub(r'[^a-z0-9]', '', self.project_name.lower()) self.instances_dir = p.join(self.base_dir, '_instances' + ('' if not self.name else '_' + self.name)) - custom_dockerd_host = custom_dockerd_host or os.environ.get('CLICKHOUSE_TESTS_DOCKERD_HOST', '') + custom_dockerd_host = custom_dockerd_host or os.environ.get('CLICKHOUSE_TESTS_DOCKERD_HOST') self.base_cmd = ['docker-compose'] if custom_dockerd_host: