Add the test for clickhouse_backupview to CI.

This commit is contained in:
Vitaly Baranov 2023-11-14 21:31:49 +01:00
parent a4d57fe108
commit 21a283049c
4 changed files with 23 additions and 2 deletions

View File

@ -68,6 +68,7 @@ RUN python3 -m pip install --no-cache-dir \
asyncio \ asyncio \
avro==1.10.2 \ avro==1.10.2 \
azure-storage-blob \ azure-storage-blob \
boto3 \
cassandra-driver \ cassandra-driver \
confluent-kafka==1.9.2 \ confluent-kafka==1.9.2 \
delta-spark==2.3.0 \ delta-spark==2.3.0 \

View File

@ -428,6 +428,7 @@ if __name__ == "__main__":
f"--volume={args.library_bridge_binary}:/clickhouse-library-bridge " f"--volume={args.library_bridge_binary}:/clickhouse-library-bridge "
f"--volume={args.base_configs_dir}:/clickhouse-config " f"--volume={args.base_configs_dir}:/clickhouse-config "
f"--volume={args.cases_dir}:/ClickHouse/tests/integration " f"--volume={args.cases_dir}:/ClickHouse/tests/integration "
f"--volume={args.utils_dir}/backupview:/ClickHouse/utils/backupview "
f"--volume={args.utils_dir}/grpc-client/pb2:/ClickHouse/utils/grpc-client/pb2 " f"--volume={args.utils_dir}/grpc-client/pb2:/ClickHouse/utils/grpc-client/pb2 "
f"--volume=/run:/run/host:ro {dockerd_internal_volume} {env_tags} {env_cleanup} " f"--volume=/run:/run/host:ro {dockerd_internal_volume} {env_tags} {env_cleanup} "
f"-e DOCKER_CLIENT_TIMEOUT=300 -e COMPOSE_HTTP_TIMEOUT=600 {use_analyzer} -e PYTHONUNBUFFERED=1 " f"-e DOCKER_CLIENT_TIMEOUT=300 -e COMPOSE_HTTP_TIMEOUT=600 {use_analyzer} -e PYTHONUNBUFFERED=1 "

View File

@ -4,11 +4,14 @@ import glob
import re import re
import random import random
import os.path import os.path
import sys
from collections import namedtuple from collections import namedtuple
from helpers.cluster import ClickHouseCluster from helpers.cluster import ClickHouseCluster
from helpers.test_tools import assert_eq_with_retry, TSV from helpers.test_tools import assert_eq_with_retry, TSV
script_dir = os.path.dirname(os.path.realpath(__file__))
cluster = ClickHouseCluster(__file__) cluster = ClickHouseCluster(__file__)
instance = cluster.add_instance( instance = cluster.add_instance(
"instance", "instance",
@ -1559,3 +1562,19 @@ def test_tables_dependency():
) )
drop() drop()
# Test for the "clickhouse_backupview" utility.
test_backupview_dir = os.path.abspath(
os.path.join(script_dir, "../../../utils/backupview/test")
)
if test_backupview_dir not in sys.path:
sys.path.append(test_backupview_dir)
import test_backupview as test_backupview_module
def test_backupview():
if instance.is_built_with_sanitizer():
return # This test is actually for clickhouse_backupview, not for ClickHouse itself.
test_backupview_module.test_backupview_1()

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Tests for the clickhouse_backupview utility. # Tests for the clickhouse_backupview utility.
# Use pytest ./test.py to run. # Use pytest ./test_backupview.py to run.
import pytest import pytest
@ -36,7 +36,7 @@ def calculate_total_size(dir):
# Actual tests # Actual tests
def test_backup_1(): def test_backupview_1():
with open_backup(os.path.join(script_dir, "test_backup_1.zip")) as b: with open_backup(os.path.join(script_dir, "test_backup_1.zip")) as b:
assert b.get_subdirs("/") == ["shards"] assert b.get_subdirs("/") == ["shards"]
assert b.dir_exists("/shards") assert b.dir_exists("/shards")