ClickHouse/tests/integration/test_limit_materialized_view_count/test.py

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

51 lines
1.4 KiB
Python
Raw Normal View History

2023-12-20 05:14:08 +00:00
import pytest
2024-09-27 10:19:39 +00:00
2023-12-20 05:14:08 +00:00
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance(
"node",
main_configs=["configs/max_num_limit.xml"],
2024-01-15 12:22:31 +00:00
stay_alive=True,
2023-12-20 05:14:08 +00:00
)
config = """<clickhouse>
<max_materialized_views_count_for_table>2</max_materialized_views_count_for_table>
</clickhouse>
"""
@pytest.fixture(scope="module")
def started_cluster():
try:
cluster.start()
for _, node in cluster.instances.items():
node.query(
f"""
CREATE TABLE test_tb (a String) ENGINE = MergeTree ORDER BY a;
"""
)
yield cluster
finally:
cluster.shutdown()
def test_limit_materialized_view_count(started_cluster):
node.query(
"CREATE MATERIALIZED VIEW test_view1 ENGINE = MergeTree ORDER BY a AS SELECT * FROM test_tb;"
)
assert "Too many materialized views" in node.query_and_get_error(
"CREATE MATERIALIZED VIEW test_view2 ENGINE = MergeTree ORDER BY a AS SELECT * FROM test_tb;"
)
node.replace_config("/etc/clickhouse-server/config.d/max_num_limit.xml", config)
2024-01-15 12:22:31 +00:00
node.restart_clickhouse()
2023-12-20 05:14:08 +00:00
node.query(
"CREATE MATERIALIZED VIEW test_view2 ENGINE = MergeTree ORDER BY a AS SELECT * FROM test_tb;"
)
assert "Too many materialized views" in node.query_and_get_error(
"CREATE MATERIALIZED VIEW test_view3 ENGINE = MergeTree ORDER BY a AS SELECT * FROM test_tb;"
)