mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Update tests
This commit is contained in:
parent
4530f38fdf
commit
633c37e3e1
@ -0,0 +1,10 @@
|
||||
<clickhouse>
|
||||
<named_collections>
|
||||
<test_s3>
|
||||
<url>http://minio1:9001/root/data/{clickhouse,database}/*</url>
|
||||
<access_key_id>minio</access_key_id>
|
||||
<secret_access_key>minio123</secret_access_key>
|
||||
<format>CSV</format>>
|
||||
</test_s3>
|
||||
</named_collections>
|
||||
</clickhouse>
|
@ -67,20 +67,20 @@ def started_cluster():
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
cluster.add_instance(
|
||||
"s0_0_0",
|
||||
main_configs=["configs/cluster.xml"],
|
||||
main_configs=["configs/cluster.xml", "configs/named_collections.xml"],
|
||||
macros={"replica": "node1", "shard": "shard1"},
|
||||
with_minio=True,
|
||||
with_zookeeper=True,
|
||||
)
|
||||
cluster.add_instance(
|
||||
"s0_0_1",
|
||||
main_configs=["configs/cluster.xml"],
|
||||
main_configs=["configs/cluster.xml", "configs/named_collections.xml"],
|
||||
macros={"replica": "replica2", "shard": "shard1"},
|
||||
with_zookeeper=True,
|
||||
)
|
||||
cluster.add_instance(
|
||||
"s0_1_0",
|
||||
main_configs=["configs/cluster.xml"],
|
||||
main_configs=["configs/cluster.xml", "configs/named_collections.xml"],
|
||||
macros={"replica": "replica1", "shard": "shard2"},
|
||||
with_zookeeper=True,
|
||||
)
|
||||
@ -406,3 +406,21 @@ def test_cluster_with_header(started_cluster):
|
||||
)
|
||||
== "SomeValue\n"
|
||||
)
|
||||
|
||||
|
||||
def test_cluster_with_named_collection(started_cluster):
|
||||
node = started_cluster.instances["s0_0_0"]
|
||||
|
||||
pure_s3 = node.query("""SELECT * from s3(test_s3) ORDER BY (c1, c2, c3)""")
|
||||
|
||||
s3_cluster = node.query(
|
||||
"""SELECT * from s3Cluster(cluster_simple, test_s3) ORDER BY (c1, c2, c3)"""
|
||||
)
|
||||
|
||||
assert TSV(pure_s3) == TSV(s3_cluster)
|
||||
|
||||
s3_cluster = node.query(
|
||||
"""SELECT * from s3Cluster(cluster_simple, test_s3, structure='auto') ORDER BY (c1, c2, c3)"""
|
||||
)
|
||||
|
||||
assert TSV(pure_s3) == TSV(s3_cluster)
|
||||
|
@ -0,0 +1,8 @@
|
||||
<clickhouse>
|
||||
<named_collections>
|
||||
<test_url>
|
||||
<url>http://nginx:80/test_1</url>
|
||||
<format>TSV</format>>
|
||||
</test_url>
|
||||
</named_collections>
|
||||
</clickhouse>
|
@ -4,7 +4,7 @@ from helpers.test_tools import TSV
|
||||
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
node1 = cluster.add_instance(
|
||||
"node1", main_configs=["configs/conf.xml"], with_nginx=True
|
||||
"node1", main_configs=["configs/conf.xml", "configs/named_collections.xml"], with_nginx=True
|
||||
)
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ def test_partition_by():
|
||||
assert result.strip() == "1\t2\t3"
|
||||
|
||||
|
||||
def test_urlCluster():
|
||||
def test_url_cluster():
|
||||
result = node1.query(
|
||||
f"select * from urlCluster('test_cluster_two_shards', 'http://nginx:80/test_1', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32')"
|
||||
)
|
||||
@ -50,6 +50,18 @@ def test_urlCluster():
|
||||
assert result.strip() == "1\t2\t3"
|
||||
|
||||
|
||||
def test_url_cluster_with_named_collection():
|
||||
result = node1.query(
|
||||
f"select * from urlCluster(test_cluster_one_shard_three_replicas_localhost, test_url)"
|
||||
)
|
||||
assert result.strip() == "3\t2\t1"
|
||||
|
||||
result = node1.query(
|
||||
f"select * from urlCluster(test_cluster_one_shard_three_replicas_localhost, test_url, structure='auto')"
|
||||
)
|
||||
assert result.strip() == "3\t2\t1"
|
||||
|
||||
|
||||
def test_table_function_url_access_rights():
|
||||
node1.query("CREATE USER OR REPLACE u1")
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
1 2 3
|
||||
4 5 6
|
||||
7 8 9
|
||||
0 0 0
|
||||
1 2 3
|
||||
4 5 6
|
||||
7 8 9
|
||||
0 0 0
|
||||
1 2 3
|
||||
4 5 6
|
||||
7 8 9
|
||||
0 0 0
|
||||
1 2 3
|
||||
4 5 6
|
||||
7 8 9
|
||||
0 0 0
|
@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tags: no-fasttest, no-s3-storage
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_CLIENT -q "create named collection $CLICKHOUSE_TEST_UNIQUE_NAME as url='http://localhost:11111/test/a.tsv'"
|
||||
$CLICKHOUSE_CLIENT -q "select * from s3Cluster(test_cluster_one_shard_three_replicas_localhost, $CLICKHOUSE_TEST_UNIQUE_NAME)"
|
||||
$CLICKHOUSE_CLIENT -q "select * from s3Cluster(test_cluster_one_shard_three_replicas_localhost, $CLICKHOUSE_TEST_UNIQUE_NAME, structure='auto')"
|
||||
$CLICKHOUSE_CLIENT -q "select * from urlCluster(test_cluster_one_shard_three_replicas_localhost, $CLICKHOUSE_TEST_UNIQUE_NAME)"
|
||||
$CLICKHOUSE_CLIENT -q "select * from urlCluster(test_cluster_one_shard_three_replicas_localhost, $CLICKHOUSE_TEST_UNIQUE_NAME, structure='auto')"
|
||||
$CLICKHOUSE_CLIENT -q "drop named collection $CLICKHOUSE_TEST_UNIQUE_NAME"
|
||||
|
Loading…
Reference in New Issue
Block a user