提交 da9cdfc2 编写于 作者: V Vitaliy Lyudvichenko 提交者: alexey-milovidov

Fix integration tests. [#CLICKHOUSE-3173]

上级 bf1949fc
......@@ -84,7 +84,8 @@ class ClickHouseCluster:
if self.is_up:
return
if destroy_dirs:
if destroy_dirs and p.exists(self.instances_dir):
print "Removing instances dir", self.instances_dir
shutil.rmtree(self.instances_dir)
for instance in self.instances.values():
......
......@@ -28,17 +28,20 @@ def ddl_check_query(instance, query, num_hosts=None):
return contents
cluster = ClickHouseCluster(__file__)
TEST_REPLICATED_ALTERS=True
cluster = ClickHouseCluster(__file__)
for i in xrange(4):
cluster.add_instance(
'ch{}'.format(i+1),
config_dir="configs",
macroses={"layer": 0, "shard": i/2 + 1, "replica": i%2 + 1},
with_zookeeper=True)
@pytest.fixture(scope="module")
def started_cluster():
try:
for i in xrange(4):
macroses = {"layer": 0, "shard": i/2 + 1, "replica": i%2 + 1}
cluster.add_instance('ch{}'.format(i+1), config_dir="configs", macroses=macroses, with_zookeeper=True)
cluster.start()
# Initialize databases and service tables
......
<yandex>
<merge_tree>
<replicated_deduplication_window>999999999</replicated_deduplication_window>
<replicated_deduplication_window_seconds>2</replicated_deduplication_window_seconds>
<cleanup_delay_period>2</cleanup_delay_period>
<replicated_deduplication_window_seconds>1</replicated_deduplication_window_seconds>
<cleanup_delay_period>1</cleanup_delay_period>
</merge_tree>
</yandex>
......@@ -35,6 +35,7 @@ ENGINE = ReplicatedMergeTree('/clickhouse/tables/0/simple2', '{replica}', date,
yield cluster
finally:
pass
cluster.shutdown()
......@@ -42,21 +43,22 @@ def test_deduplication_window_in_seconds(started_cluster):
node = node1
node.query("INSERT INTO simple2 VALUES (0, 0)")
time.sleep(1)
node.query("INSERT INTO simple2 VALUES (0, 0)") # deduplication works here
node.query("INSERT INTO simple2 VALUES (0, 1)")
node.query("INSERT INTO simple2 VALUES (0, 1)") # deduplication works here
assert TSV(node.query("SELECT count() FROM simple2")) == TSV("2\n")
# wait clean thread
time.sleep(2)
node.query("INSERT INTO simple2 VALUES (0, 1)") # deduplication doesn't works here, hash node was deleted
assert TSV(node.query("SELECT count() FROM simple2")) == TSV("3\n")
assert TSV.toMat(node.query("SELECT count() FROM system.zookeeper WHERE path='/clickhouse/tables/0/simple2/blocks'"))[0][0] == "1"
node.query("INSERT INTO simple2 VALUES (0, 0)") # deduplication doesn't works here, the first hash node was deleted
assert TSV.toMat(node.query("SELECT count() FROM simple2"))[0][0] == "3"
def check_timeout_exception(e):
s = str(e)
print s
#print s
assert s.find('timed out!') >= 0 or s.find('Return code: -9') >= 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册