Merge pull request #24954 from ClickHouse/fix_integration_test

This commit is contained in:
Ilya Yatsishin 2021-06-05 20:18:33 +03:00 committed by GitHub
commit f2eed22ebd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 4 deletions

View File

@ -261,7 +261,7 @@ class ClickhouseIntegrationTestsRunner:
def _get_all_tests(self, repo_path): def _get_all_tests(self, repo_path):
image_cmd = self._get_runner_image_cmd(repo_path) image_cmd = self._get_runner_image_cmd(repo_path)
cmd = "cd {}/tests/integration && ./runner --tmpfs {} ' --setup-plan' | grep '::' | sed 's/ (fixtures used:.*//g' | sed 's/^ *//g' | sed 's/ *$//g' | sort -u > all_tests.txt".format(repo_path, image_cmd) cmd = "cd {}/tests/integration && ./runner --tmpfs {} ' --setup-plan' | grep '::' | sed 's/ (fixtures used:.*//g' | sed 's/^ *//g' | sed 's/ *$//g' | grep -v 'SKIPPED' | sort -u > all_tests.txt".format(repo_path, image_cmd)
logging.info("Getting all tests with cmd '%s'", cmd) logging.info("Getting all tests with cmd '%s'", cmd)
subprocess.check_call(cmd, shell=True) # STYLE_CHECK_ALLOW_SUBPROCESS_CHECK_CALL subprocess.check_call(cmd, shell=True) # STYLE_CHECK_ALLOW_SUBPROCESS_CHECK_CALL
@ -491,7 +491,7 @@ class ClickhouseIntegrationTestsRunner:
grouped_tests = self.group_test_by_file(filtered_sequential_tests) grouped_tests = self.group_test_by_file(filtered_sequential_tests)
i = 0 i = 0
for par_group in chunks(filtered_parallel_tests, PARALLEL_GROUP_SIZE): for par_group in chunks(filtered_parallel_tests, PARALLEL_GROUP_SIZE):
grouped_tests["parallel{}".format(i)] = par_group grouped_tests["parallel{}".format(i)] = par_group
i+=1 i+=1
logging.info("Found %s tests groups", len(grouped_tests)) logging.info("Found %s tests groups", len(grouped_tests))

View File

@ -2042,7 +2042,6 @@ class ClickHouseInstance:
instance_config_dir = p.abspath(p.join(self.path, 'configs')) instance_config_dir = p.abspath(p.join(self.path, 'configs'))
os.makedirs(instance_config_dir) os.makedirs(instance_config_dir)
os.chmod(instance_config_dir, stat.S_IRWXO)
print(f"Copy common default production configuration from {self.base_config_dir}. Files: {self.main_config_name}, {self.users_config_name}") print(f"Copy common default production configuration from {self.base_config_dir}. Files: {self.main_config_name}, {self.users_config_name}")

View File

@ -3,6 +3,7 @@ import pytest
from helpers.cluster import ClickHouseCluster from helpers.cluster import ClickHouseCluster
from helpers.network import PartitionManager from helpers.network import PartitionManager
from helpers.test_tools import assert_eq_with_retry from helpers.test_tools import assert_eq_with_retry
import time
def fill_nodes(nodes, shard): def fill_nodes(nodes, shard):
@ -61,9 +62,15 @@ def test_inconsistent_parts_if_drop_while_replica_not_active(start_cluster):
assert_eq_with_retry(node2, "SELECT value FROM system.zookeeper WHERE path='/clickhouse/tables/test1/replicated/replicas/node1' AND name='is_lost'", "1") assert_eq_with_retry(node2, "SELECT value FROM system.zookeeper WHERE path='/clickhouse/tables/test1/replicated/replicas/node1' AND name='is_lost'", "1")
for i in range(30):
if node2.contains_in_log("Will mark replica node1 as lost"):
break
time.sleep(0.5)
# the first replica will be cloned from the second # the first replica will be cloned from the second
pm.heal_all() pm.heal_all()
assert_eq_with_retry(node1, "SELECT count(*) FROM test_table", node2.query("SELECT count(*) FROM test_table")) assert_eq_with_retry(node1, "SELECT count(*) FROM test_table", node2.query("SELECT count(*) FROM test_table"))
# ensure replica was cloned # ensure replica was cloned
assert node1.contains_in_log("Will mimic node2") assert node1.contains_in_log("Will mimic node2")
# queue must be empty (except some merges that are possibly executing right now) # queue must be empty (except some merges that are possibly executing right now)

View File

@ -42,7 +42,7 @@ def test_partition_simple(partition_table_simple):
def exec_bash(cmd): def exec_bash(cmd):
cmd = '/bin/bash -c "{}"'.format(cmd.replace('"', '\\"')) cmd = ["/bin/bash", "-c", cmd.replace('"', '\\"')]
return instance.exec_in_container(cmd) return instance.exec_in_container(cmd)