ClickHouse/tests/integration/test_s3_style_link/test.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

90 lines
2.0 KiB
Python
Raw Permalink Normal View History

2023-09-27 18:53:05 +00:00
import logging
2024-09-27 10:19:39 +00:00
2023-09-27 18:53:05 +00:00
import pytest
2024-09-27 10:19:39 +00:00
from helpers.cluster import ClickHouseCluster
2023-09-27 18:53:05 +00:00
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance(
"node",
main_configs=[
"configs/config.d/minio.xml",
],
user_configs=[
"configs/users.d/users.xml",
],
with_minio=True,
)
@pytest.fixture(scope="module")
def started_cluster():
try:
logging.info("Starting cluster...")
cluster.start()
logging.info("Cluster started")
yield cluster
finally:
logging.info("Stopping cluster")
cluster.shutdown()
logging.info("Cluster stopped")
def test_s3_table_functions(started_cluster):
"""
Simple test to check s3 table function functionalities
"""
node.query(
"""
INSERT INTO FUNCTION s3
(
'minio://data/test_file.tsv.gz', 'minio', 'minio123'
)
SELECT * FROM numbers(1000000);
"""
)
assert (
node.query(
2023-09-27 20:27:48 +00:00
"""
2023-09-27 18:53:05 +00:00
SELECT count(*) FROM s3
(
'minio://data/test_file.tsv.gz', 'minio', 'minio123'
);
"""
)
== "1000000\n"
)
2023-11-28 17:33:46 +00:00
2023-11-28 18:13:37 +00:00
2023-11-28 17:33:46 +00:00
def test_s3_table_functions_line_as_string(started_cluster):
node.query(
"""
INSERT INTO FUNCTION s3
(
'minio://data/test_file_line_as_string.tsv.gz', 'minio', 'minio123'
)
SELECT * FROM numbers(1000000);
"""
)
assert (
node.query(
"""
SELECT _file FROM s3
(
'minio://data/*as_string.tsv.gz', 'minio', 'minio123', 'LineAsString'
) LIMIT 1;
"""
)
== node.query(
"""
SELECT _file FROM s3
(
'http://minio1:9001/root/data/*as_string.tsv.gz', 'minio', 'minio123', 'LineAsString'
) LIMIT 1;
"""
)
)