mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
Merge pull request #64220 from yariks5s/test_distributed_table_exception
Add test for #37090
This commit is contained in:
commit
73d0b51283
@ -0,0 +1,12 @@
|
||||
<clickhouse>
|
||||
<remote_servers>
|
||||
<localhost_cluster>
|
||||
<shard>
|
||||
<replica>
|
||||
<host>localhost</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
</shard>
|
||||
</localhost_cluster>
|
||||
</remote_servers>
|
||||
</clickhouse>
|
@ -0,0 +1,35 @@
|
||||
import pytest
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
import logging
|
||||
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
node = cluster.add_instance("node", main_configs=["configs/clusters.xml"])
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def start_cluster():
|
||||
try:
|
||||
logging.info("Starting cluster...")
|
||||
cluster.start()
|
||||
logging.info("Cluster started")
|
||||
|
||||
yield cluster
|
||||
finally:
|
||||
cluster.shutdown()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("prefer_localhost_replica", [0, 1])
|
||||
def test_distributed_table_with_alias(start_cluster, prefer_localhost_replica):
|
||||
node.query(
|
||||
"""
|
||||
DROP TABLE IF EXISTS local;
|
||||
DROP TABLE IF EXISTS dist;
|
||||
CREATE TABLE local(`dummy` UInt8) ENGINE = MergeTree ORDER BY tuple();
|
||||
CREATE TABLE dist AS local ENGINE = Distributed(localhost_cluster, currentDatabase(), local);
|
||||
"""
|
||||
)
|
||||
|
||||
node.query(
|
||||
"WITH 'Hello' AS `alias` SELECT `alias` FROM dist GROUP BY `alias`;",
|
||||
settings={"prefer_localhost_replica": prefer_localhost_replica},
|
||||
)
|
Loading…
Reference in New Issue
Block a user