ClickHouse/tests/integration/test_table_db_num_limit/test.py

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

44 lines
1.1 KiB
Python
Raw Normal View History

2024-06-10 20:46:13 +00:00
import pytest
from helpers.client import QueryRuntimeException
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node1 = cluster.add_instance(
"node1", main_configs=["config/config.xml"], with_zookeeper=True
)
2024-06-10 21:02:34 +00:00
2024-06-10 20:46:13 +00:00
@pytest.fixture(scope="module")
def started_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
2024-06-10 21:02:34 +00:00
2024-06-10 20:46:13 +00:00
def test_table_db_limit(started_cluster):
2024-06-12 13:51:32 +00:00
for i in range(10):
2024-06-10 20:46:13 +00:00
node1.query("create database db{}".format(i))
with pytest.raises(QueryRuntimeException) as exp_info:
node1.query("create database db_exp".format(i))
assert "TOO_MANY_DATABASES" in str(exp_info)
2024-06-14 13:28:21 +00:00
for i in range(10):
node1.query("create table t{} (a Int32) Engine = Log".format(i))
2024-06-18 03:09:13 +00:00
node1.query("system flush logs")
2024-06-14 13:28:21 +00:00
for i in range(10):
node1.query("drop table t{}".format(i))
2024-06-10 20:46:13 +00:00
for i in range(10):
node1.query("create table t{} (a Int32) Engine = Log".format(i))
with pytest.raises(QueryRuntimeException) as exp_info:
node1.query("create table default.tx (a Int32) Engine = Log")
assert "TOO_MANY_TABLES" in str(exp_info)