diff --git a/tests/integration/test_storage_mysql/test.py b/tests/integration/test_storage_mysql/test.py index eda664b4264..9b061626193 100644 --- a/tests/integration/test_storage_mysql/test.py +++ b/tests/integration/test_storage_mysql/test.py @@ -214,7 +214,7 @@ def test_mysql_distributed(started_cluster): ENGINE = MySQL(`mysql{}:3306`, 'clickhouse', 'test_replicas', 'root', 'clickhouse');'''.format(i, i)) node1.query("INSERT INTO test_replica{} (id, name) SELECT number, 'host{}' from numbers(10) ".format(i, i)) - # check all remote replicas are accessible throught that table + # check all replicas are traversed query = "SELECT * FROM (" for i in range (3): query += "SELECT name FROM test_replicas UNION DISTINCT " @@ -229,7 +229,11 @@ def test_mysql_distributed(started_cluster): (id UInt32, name String, age UInt32, money UInt32) ENGINE = ExternalDistributed('MySQL', `mysql{1|2}:3306,mysql{3|4}:3306`, 'clickhouse', 'test_replicas', 'root', 'clickhouse'); ''') - # check both remote replicas are accessible throught that table + # Check only one replica in each shard is used + result = node1.query("SELECT DISTINCT(name) FROM test_shards ORDER BY name") + assert(result == 'host1\nhost3\n') + + # check all replicas are traversed query = "SELECT name FROM (" for i in range (2): query += "SELECT name FROM test_shards UNION DISTINCT " diff --git a/tests/integration/test_storage_postgresql/test.py b/tests/integration/test_storage_postgresql/test.py index 9d3a3063463..96a988bb03e 100644 --- a/tests/integration/test_storage_postgresql/test.py +++ b/tests/integration/test_storage_postgresql/test.py @@ -248,7 +248,7 @@ def test_postgres_distributed(started_cluster): (id UInt32, name String) ENGINE = PostgreSQL(`postgres{1|2|3}:5432`, 'clickhouse', 'test_replicas', 'postgres', 'mysecretpassword'); ''') - # check both remote replicas are accessible throught that table + # check all replicas are traversed query = "SELECT name FROM (" for i in range (3): query += "SELECT name FROM test_replicas UNION DISTINCT " @@ -263,7 +263,11 @@ def test_postgres_distributed(started_cluster): (id UInt32, name String, age UInt32, money UInt32) ENGINE = ExternalDistributed('PostgreSQL', `postgres{1|2}:5432,postgres{3|4}:5432`, 'clickhouse', 'test_replicas', 'postgres', 'mysecretpassword'); ''') - # check both remote replicas are accessible throught that table + # Check only one replica in each shard is used + result = node1.query("SELECT DISTINCT(name) FROM test_shards ORDER BY name") + assert(result == 'host1\nhost3\n') + + # check all replicas are traversed query = "SELECT name FROM (" for i in range (2): query += "SELECT name FROM test_shards UNION DISTINCT "