mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
CLICKHOUSE-3894: Fixes in tests
This commit is contained in:
parent
8200827723
commit
e8438572ad
@ -76,6 +76,12 @@ class ClickHouseCluster:
|
||||
self.is_up = False
|
||||
|
||||
|
||||
def get_client_cmd(self):
|
||||
cmd = self.client_bin_path
|
||||
if p.basename(cmd) == 'clickhouse':
|
||||
cmd += " client"
|
||||
return cmd
|
||||
|
||||
def add_instance(self, name, config_dir=None, main_configs=[], user_configs=[], macros={}, with_zookeeper=False, with_mysql=False, with_kafka=False, clickhouse_path_dir=None, with_odbc_drivers=False, hostname=None, env_variables={}, image="ubuntu:14.04"):
|
||||
"""Add an instance to the cluster.
|
||||
|
||||
|
@ -67,20 +67,20 @@ def test_deduplication_works_in_case_of_intensive_inserts(started_cluster):
|
||||
inserters.append(CommandRequest(['/bin/bash'], timeout=10, stdin="""
|
||||
set -e
|
||||
for i in `seq 1000`; do
|
||||
clickhouse-client --host {} -q "INSERT INTO simple VALUES (0, 0)"
|
||||
{} --host {} -q "INSERT INTO simple VALUES (0, 0)"
|
||||
done
|
||||
""".format(host)))
|
||||
""".format(cluster.get_client_cmd(), host)))
|
||||
|
||||
fetchers.append(CommandRequest(['/bin/bash'], timeout=10, stdin="""
|
||||
set -e
|
||||
for i in `seq 1000`; do
|
||||
res=`clickhouse-client --host {} -q "SELECT count() FROM simple"`
|
||||
res=`{} --host {} -q "SELECT count() FROM simple"`
|
||||
if [[ $? -ne 0 || $res -ne 1 ]]; then
|
||||
echo "Selected $res elements! Host: {}" 1>&2
|
||||
exit -1
|
||||
fi;
|
||||
done
|
||||
""".format(host, node.name)))
|
||||
""".format(cluster.get_client_cmd(), host, node.name)))
|
||||
|
||||
# There were not errors during INSERTs
|
||||
for inserter in inserters:
|
||||
|
@ -50,7 +50,7 @@ def test_random_inserts(started_cluster):
|
||||
bash_script = os.path.join(os.path.dirname(__file__), "test.sh")
|
||||
inserters = []
|
||||
for node in nodes:
|
||||
cmd = ['/bin/bash', bash_script, node.ip_address, str(min_timestamp), str(max_timestamp)]
|
||||
cmd = ['/bin/bash', bash_script, node.ip_address, str(min_timestamp), str(max_timestamp), str(cluster.get_client_cmd())]
|
||||
inserters.append(CommandRequest(cmd, timeout=DURATION_SECONDS * 2, stdin=''))
|
||||
print node.name, node.ip_address
|
||||
|
||||
@ -60,7 +60,7 @@ def test_random_inserts(started_cluster):
|
||||
answer="{}\t{}\t{}\t{}\n".format(num_timestamps, num_timestamps, min_timestamp, max_timestamp)
|
||||
|
||||
for node in nodes:
|
||||
res = node.query("SELECT count(), uniqExact(i), min(i), max(i) FROM simple")
|
||||
res = node.query_with_retry("SELECT count(), uniqExact(i), min(i), max(i) FROM simple", check_callback=lambda res: TSV(res) == TSV(answer))
|
||||
assert TSV(res) == TSV(answer), node.name + " : " + node.query("SELECT groupArray(_part), i, count() AS c FROM simple GROUP BY i ORDER BY c DESC LIMIT 1")
|
||||
|
||||
node1.query("""DROP TABLE simple ON CLUSTER test_cluster""")
|
||||
|
@ -4,7 +4,7 @@
|
||||
[[ -n "$1" ]] && host="$1" || host="localhost"
|
||||
[[ -n "$2" ]] && min_timestamp="$2" || min_timestamp=$(( $(date +%s) - 60 ))
|
||||
[[ -n "$3" ]] && max_timestamp="$3" || max_timestamp=$(( $(date +%s) + 60 ))
|
||||
[[ -n "$4" ]] && iters_per_timestamp="$4" || iters_per_timestamp=5
|
||||
[[ -n "$4" ]] && client="$4" || client="clickhouse-client"
|
||||
|
||||
timestamps=`seq $min_timestamp $max_timestamp`
|
||||
|
||||
@ -18,7 +18,7 @@ function reliable_insert {
|
||||
fi
|
||||
|
||||
#echo clickhouse-client --host $host -q "INSERT INTO simple VALUES (0, $ts, '$ts')"
|
||||
res=`clickhouse-client --host $host -q "INSERT INTO simple VALUES (0, $ts, '$ts')" 2>&1`
|
||||
res=`$client --host $host -q "INSERT INTO simple VALUES (0, $ts, '$ts')" 2>&1`
|
||||
rt=$?
|
||||
num_tries=$(($num_tries+1))
|
||||
|
||||
|
@ -130,7 +130,7 @@ class Runner:
|
||||
|
||||
|
||||
def test_mutations(started_cluster):
|
||||
DURATION_SECONDS = 50
|
||||
DURATION_SECONDS = 30
|
||||
|
||||
runner = Runner()
|
||||
|
||||
@ -155,8 +155,8 @@ def test_mutations(started_cluster):
|
||||
assert runner.total_mutations > 0
|
||||
|
||||
all_done = False
|
||||
for i in range(100): # wait for replication 50 seconds max
|
||||
time.sleep(0.5)
|
||||
for i in range(100): # wait for replication 80 seconds max
|
||||
time.sleep(0.8)
|
||||
|
||||
def get_done_mutations(node):
|
||||
return int(node.query("SELECT sum(is_done) FROM system.mutations WHERE table = 'test_mutations'").rstrip())
|
||||
|
Loading…
Reference in New Issue
Block a user