Merge pull request #68178 from ClickHouse/fix-68177

Fix `test_cluster_all_replicas`
This commit is contained in:
Alexey Milovidov 2024-08-12 21:52:13 +00:00 committed by GitHub
commit 203857020f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,14 +21,14 @@ def start_cluster():
def test_cluster(start_cluster): def test_cluster(start_cluster):
assert ( assert (
node1.query( node1.query(
"SELECT hostName() FROM clusterAllReplicas('one_shard_two_nodes', system.one)" "SELECT hostName() FROM clusterAllReplicas('one_shard_two_nodes', system.one) ORDER BY ALL"
) )
== "node1\nnode2\n" == "node1\nnode2\n"
) )
assert set( assert set(
node1.query( node1.query(
"""SELECT hostName(), * FROM clusterAllReplicas("one_shard_two_nodes", system.one) ORDER BY dummy""" """SELECT hostName(), * FROM clusterAllReplicas("one_shard_two_nodes", system.one) ORDER BY ALL"""
).splitlines() ).splitlines()
) == {"node1\t0", "node2\t0"} ) == {"node1\t0", "node2\t0"}
@ -48,7 +48,7 @@ def test_global_in(start_cluster):
assert set( assert set(
node1.query( node1.query(
"""SELECT hostName(), * FROM clusterAllReplicas("one_shard_two_nodes", system.one) where dummy GLOBAL IN u""" """SELECT hostName(), * FROM clusterAllReplicas("one_shard_two_nodes", system.one) where dummy GLOBAL IN u ORDER BY ALL"""
).splitlines() ).splitlines()
) == {"node1\t0", "node2\t0"} ) == {"node1\t0", "node2\t0"}
@ -63,7 +63,7 @@ def test_global_in(start_cluster):
def test_skip_unavailable_replica(start_cluster, cluster): def test_skip_unavailable_replica(start_cluster, cluster):
assert ( assert (
node1.query( node1.query(
f"SELECT hostName() FROM clusterAllReplicas('{cluster}', system.one) settings skip_unavailable_shards=1" f"SELECT hostName() FROM clusterAllReplicas('{cluster}', system.one) ORDER BY ALL settings skip_unavailable_shards=1"
) )
== "node1\nnode2\n" == "node1\nnode2\n"
) )
@ -81,5 +81,5 @@ def test_error_on_unavailable_replica(start_cluster, cluster):
# so when skip_unavailable_shards=0 - any unavailable replica should lead to an error # so when skip_unavailable_shards=0 - any unavailable replica should lead to an error
with pytest.raises(QueryRuntimeException): with pytest.raises(QueryRuntimeException):
node1.query( node1.query(
f"SELECT hostName() FROM clusterAllReplicas('{cluster}', system.one) settings skip_unavailable_shards=0" f"SELECT hostName() FROM clusterAllReplicas('{cluster}', system.one) ORDER BY ALL settings skip_unavailable_shards=0"
) )