This commit is contained in:
Yatsishin Ilya 2021-06-02 18:08:16 +03:00
parent 6a9b875b19
commit ddddb761db
6 changed files with 11 additions and 11 deletions

View File

@ -53,7 +53,7 @@ def _create_env_file(path, variables):
def run_and_check(args, env=None, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=180, nothrow=False, detach=False):
if detach:
subprocess.Popen(args, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=env, shell=shell, timeout=timeout)
subprocess.Popen(args, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=env, shell=shell)
return
res = subprocess.run(args, stdout=stdout, stderr=stderr, env=env, shell=shell, timeout=timeout)

View File

@ -1,7 +1,7 @@
[pytest]
python_files = test*.py
norecursedirs = _instances
timeout = 300
timeout = 1800
junit_duration_report = call
junit_suite_name = integration
log_cli = 1

View File

@ -252,7 +252,7 @@ if __name__ == "__main__":
--volume={library_bridge_bin}:/clickhouse-library-bridge --volume={bin}:/clickhouse \
--volume={base_cfg}:/clickhouse-config --volume={cases_dir}:/ClickHouse/tests/integration \
--volume={src_dir}/Server/grpc_protos:/ClickHouse/src/Server/grpc_protos \
{dockerd_internal_volume} -e DOCKER_CLIENT_TIMEOUT=120 -e COMPOSE_HTTP_TIMEOUT=300 \
{dockerd_internal_volume} -e DOCKER_CLIENT_TIMEOUT=300 -e COMPOSE_HTTP_TIMEOUT=600 \
{env_tags} -e PYTEST_OPTS='{parallel} {opts} {tests_list}' {img} {command}".format(
net=net,
tty=tty,

View File

@ -60,7 +60,7 @@ def get_loading_duration(dictionary_name):
def replace_in_file_in_container(file_name, what, replace_with):
instance.exec_in_container('sed -i "s/' + what + '/' + replace_with + '/g" ' + file_name)
instance.exec_in_container(['sed', '-i', f's/{what}/{replace_with}/g', file_name])
def test_reload_while_loading(started_cluster):
@ -180,7 +180,7 @@ def test_reload_after_fail_by_system_reload(started_cluster):
assert get_status("no_file") == "LOADED"
# Removing the file source should not spoil the loaded dictionary.
instance.exec_in_container("rm /etc/clickhouse-server/config.d/no_file.txt")
instance.exec_in_container(["rm", "/etc/clickhouse-server/config.d/no_file.txt"])
assert no_such_file_error in instance.query_and_get_error("SYSTEM RELOAD DICTIONARY 'no_file'")
query("SELECT dictGetInt32('no_file', 'a', toUInt64(9))") == "10\n"
assert get_status("no_file") == "LOADED"
@ -206,13 +206,13 @@ def test_reload_after_fail_by_timer(started_cluster):
# Check that file appears in container and wait if needed.
while not instance.file_exists("/etc/clickhouse-server/config.d/no_file_2.txt"):
time.sleep(1)
assert("9\t10\n" == instance.exec_in_container("cat /etc/clickhouse-server/config.d/no_file_2.txt"))
assert("9\t10\n" == instance.exec_in_container(["cat", "/etc/clickhouse-server/config.d/no_file_2.txt"]))
instance.query("SYSTEM RELOAD DICTIONARY no_file_2")
instance.query("SELECT dictGetInt32('no_file_2', 'a', toUInt64(9))") == "10\n"
assert get_status("no_file_2") == "LOADED"
# Removing the file source should not spoil the loaded dictionary.
instance.exec_in_container("rm /etc/clickhouse-server/config.d/no_file_2.txt")
instance.exec_in_container(["rm", "/etc/clickhouse-server/config.d/no_file_2.txt"])
time.sleep(6);
instance.query("SELECT dictGetInt32('no_file_2', 'a', toUInt64(9))") == "10\n"
assert get_status("no_file_2") == "LOADED"

View File

@ -69,7 +69,7 @@ def put_s3_file_content(started_cluster, bucket, filename, data):
# Returns content of given S3 file as string.
def get_s3_file_content(started_cluster, bucket, filename, decode=True):
# type: (ClickHouseCluster, str) -> str
# type: (ClickHouseCluster, str, str, bool) -> str
data = started_cluster.minio_client.get_object(bucket, filename)
data_str = b""
@ -191,7 +191,7 @@ def test_get_path_with_special(started_cluster, special):
pytest.param("'minio','minio123',", id="minio")
])
def test_empty_put(started_cluster, auth):
# type: (ClickHouseCluster) -> None
# type: (ClickHouseCluster, str) -> None
bucket = started_cluster.minio_bucket
instance = started_cluster.instances["dummy"] # type: ClickHouseInstance
@ -227,7 +227,7 @@ def test_empty_put(started_cluster, auth):
pytest.param("'wrongid','wrongkey',", False, id="negative"),
])
def test_put_csv(started_cluster, maybe_auth, positive):
# type: (ClickHouseCluster) -> None
# type: (ClickHouseCluster, bool, str) -> None
bucket = started_cluster.minio_bucket if not maybe_auth else started_cluster.minio_restricted_bucket
instance = started_cluster.instances["dummy"] # type: ClickHouseInstance

View File

@ -15,7 +15,7 @@ def started_cluster():
cluster.start()
for i in range(2, 8):
node.exec_in_container("cp /etc/clickhouse-server/users.xml /etc/clickhouse-server/users{}.xml".format(i))
node.exec_in_container(["cp", "/etc/clickhouse-server/users.xml", "/etc/clickhouse-server/users{}.xml".format(i)])
yield cluster