Update test_distributed_format to cover remote_servers via <node>

This commit is contained in:
Azat Khuzhin 2020-06-08 22:15:30 +03:00
parent c35f5e9271
commit eee2fb867a
2 changed files with 21 additions and 7 deletions

View File

@ -8,5 +8,12 @@
</replica>
</shard>
</test_cluster>
<test_cluster_2>
<node>
<host>not_existing</host>
<port>9000</port>
</node>
</test_cluster_2>
</remote_servers>
</yandex>

View File

@ -11,6 +11,11 @@ from helpers.test_tools import assert_eq_with_retry
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance('node', config_dir="configs", main_configs=['configs/remote_servers.xml'])
cluster_param = pytest.mark.parametrize("cluster", [
('test_cluster'),
('test_cluster_2'),
])
@pytest.fixture(scope="module")
def started_cluster():
@ -22,9 +27,9 @@ def started_cluster():
finally:
cluster.shutdown()
def test_single_file(started_cluster):
node.query("create table test.distr_1 (x UInt64, s String) engine = Distributed('test_cluster', database, table)")
@cluster_param
def test_single_file(started_cluster, cluster):
node.query("create table test.distr_1 (x UInt64, s String) engine = Distributed('{}', database, table)".format(cluster))
node.query("insert into test.distr_1 values (1, 'a'), (2, 'bb'), (3, 'ccc')", settings={"use_compact_format_in_distributed_parts_names": "1"})
query = "select * from file('/var/lib/clickhouse/data/test/distr_1/shard1_replica1/1.bin', 'Distributed')"
@ -41,8 +46,9 @@ def test_single_file(started_cluster):
node.query("drop table test.distr_1")
def test_two_files(started_cluster):
node.query("create table test.distr_2 (x UInt64, s String) engine = Distributed('test_cluster', database, table)")
@cluster_param
def test_two_files(started_cluster, cluster):
node.query("create table test.distr_2 (x UInt64, s String) engine = Distributed('{}', database, table)".format(cluster))
node.query("insert into test.distr_2 values (0, '_'), (1, 'a')", settings={"use_compact_format_in_distributed_parts_names": "1"})
node.query("insert into test.distr_2 values (2, 'bb'), (3, 'ccc')", settings={"use_compact_format_in_distributed_parts_names": "1"})
@ -60,8 +66,9 @@ def test_two_files(started_cluster):
node.query("drop table test.distr_2")
def test_single_file_old(started_cluster):
node.query("create table test.distr_3 (x UInt64, s String) engine = Distributed('test_cluster', database, table)")
@cluster_param
def test_single_file_old(started_cluster, cluster):
node.query("create table test.distr_3 (x UInt64, s String) engine = Distributed('{}', database, table)".format(cluster))
node.query("insert into test.distr_3 values (1, 'a'), (2, 'bb'), (3, 'ccc')")
query = "select * from file('/var/lib/clickhouse/data/test/distr_3/default@not_existing:9000/1.bin', 'Distributed')"