mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix some flaky tests
This commit is contained in:
parent
65ce3929b8
commit
c7781e24d5
@ -29,7 +29,6 @@ from dict2xml import dict2xml
|
||||
from kazoo.client import KazooClient
|
||||
from kazoo.exceptions import KazooException
|
||||
from minio import Minio
|
||||
from minio.deleteobjects import DeleteObject
|
||||
from helpers.test_tools import assert_eq_with_retry
|
||||
|
||||
import docker
|
||||
@ -172,6 +171,13 @@ def enable_consistent_hash_plugin(rabbitmq_id):
|
||||
p.communicate()
|
||||
return p.returncode == 0
|
||||
|
||||
def get_instances_dir():
|
||||
if 'INTEGRATION_TESTS_RUN_ID' in os.environ:
|
||||
return '_instances_' + shlex.quote(os.environ['INTEGRATION_TESTS_RUN_ID'])
|
||||
else:
|
||||
return '_instances'
|
||||
|
||||
|
||||
class ClickHouseCluster:
|
||||
"""ClickHouse cluster with several instances and (possibly) ZooKeeper.
|
||||
|
||||
@ -1232,8 +1238,8 @@ class ClickHouseCluster:
|
||||
for bucket in buckets:
|
||||
if minio_client.bucket_exists(bucket):
|
||||
delete_object_list = map(
|
||||
lambda x: DeleteObject(x.object_name),
|
||||
minio_client.list_objects(bucket, recursive=True),
|
||||
lambda x: x.object_name,
|
||||
minio_client.list_objects_v2(bucket, recursive=True),
|
||||
)
|
||||
errors = minio_client.remove_objects(bucket, delete_object_list)
|
||||
for error in errors:
|
||||
|
@ -1,6 +1,6 @@
|
||||
[pytest]
|
||||
python_files = test*.py
|
||||
norecursedirs = _instances
|
||||
norecursedirs = _instances*
|
||||
timeout = 1800
|
||||
junit_duration_report = call
|
||||
junit_suite_name = integration
|
||||
|
@ -6,7 +6,7 @@ import threading
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
from helpers.cluster import ClickHouseCluster, get_instances_dir
|
||||
|
||||
|
||||
# By default the exceptions that was throwed in threads will be ignored
|
||||
@ -30,7 +30,7 @@ class SafeThread(threading.Thread):
|
||||
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
CONFIG_PATH = os.path.join(SCRIPT_DIR, './_instances/node/configs/config.d/storage_conf.xml')
|
||||
CONFIG_PATH = os.path.join(SCRIPT_DIR, './{}/node/configs/config.d/storage_conf.xml'.format(get_instances_dir()))
|
||||
|
||||
|
||||
def replace_config(old, new):
|
||||
|
@ -2,13 +2,14 @@ import os
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
from helpers.cluster import ClickHouseCluster, get_instances_dir
|
||||
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
node = cluster.add_instance('node', main_configs=["configs/max_table_size_to_drop.xml"])
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
CONFIG_PATH = os.path.join(SCRIPT_DIR, './_instances/node/configs/config.d/max_table_size_to_drop.xml')
|
||||
|
||||
CONFIG_PATH = os.path.join(SCRIPT_DIR, './{}/node/configs/config.d/max_table_size_to_drop.xml'.format(get_instances_dir()))
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
|
@ -9,12 +9,13 @@ import time
|
||||
|
||||
import helpers.client
|
||||
import pytest
|
||||
from helpers.cluster import ClickHouseCluster, ClickHouseInstance
|
||||
from helpers.cluster import ClickHouseCluster, ClickHouseInstance, get_instances_dir
|
||||
|
||||
MINIO_INTERNAL_PORT = 9001
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
CONFIG_PATH = os.path.join(SCRIPT_DIR, './_instances/dummy/configs/config.d/defaultS3.xml')
|
||||
|
||||
CONFIG_PATH = os.path.join(SCRIPT_DIR, './{}/dummy/configs/config.d/defaultS3.xml'.format(get_instances_dir()))
|
||||
|
||||
|
||||
# Creates S3 bucket for tests and allows anonymous read-write access to it.
|
||||
|
@ -20,9 +20,8 @@ system_logs = [
|
||||
('system.metric_log', 1),
|
||||
]
|
||||
|
||||
# Default timeout for flush is 60
|
||||
# decrease timeout for the test to show possible issues.
|
||||
timeout = pytest.mark.timeout(30)
|
||||
# 60 -- Default timeout for flush
|
||||
timeout = pytest.mark.timeout(60)
|
||||
|
||||
|
||||
@pytest.fixture(scope='module', autouse=True)
|
||||
|
Loading…
Reference in New Issue
Block a user