mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Add more tests and handle correctly missing include
This commit is contained in:
parent
4c3882f2f9
commit
700850a970
@ -318,8 +318,13 @@ void ConfigProcessor::doIncludesRecursive(
|
||||
else if (throw_on_bad_incl)
|
||||
throw Poco::Exception(error_msg + name);
|
||||
else
|
||||
{
|
||||
if (node->nodeName() == "include")
|
||||
node->parentNode()->removeChild(node);
|
||||
|
||||
LOG_WARNING(log, "{}{}", error_msg, name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Replace the whole node not just contents.
|
||||
|
@ -10,5 +10,8 @@
|
||||
<profile>default</profile>
|
||||
<quota>default</quota>
|
||||
</default>
|
||||
|
||||
<include incl="users_1" />
|
||||
<include incl="users_2" />
|
||||
</users>
|
||||
</yandex>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<yandex>
|
||||
<include_from>/etc/clickhouse-server/config.d/max_query_size.xml</include_from>
|
||||
<include_from>/etc/clickhouse-server/config.d/include_from_source.xml</include_from>
|
||||
<profiles>
|
||||
<default>
|
||||
<max_query_size incl="mqs" />
|
||||
@ -11,5 +11,8 @@
|
||||
<profile>default</profile>
|
||||
<quota>default</quota>
|
||||
</default>
|
||||
|
||||
<include incl="users_1" />
|
||||
<include incl="users_2" />
|
||||
</users>
|
||||
</yandex>
|
||||
|
@ -11,5 +11,7 @@
|
||||
<profile>default</profile>
|
||||
<quota>default</quota>
|
||||
</default>
|
||||
|
||||
<include incl="node_does_not_exist" />
|
||||
</users>
|
||||
</yandex>
|
||||
|
@ -0,0 +1,17 @@
|
||||
<yandex>
|
||||
<mqs>99999</mqs>
|
||||
|
||||
<users_1>
|
||||
<user_1>
|
||||
<password></password>
|
||||
<profile>default</profile>
|
||||
</user_1>
|
||||
</users_1>
|
||||
|
||||
<users_2>
|
||||
<user_2>
|
||||
<password></password>
|
||||
<profile>default</profile>
|
||||
</user_2>
|
||||
</users_2>
|
||||
</yandex>
|
@ -1,3 +0,0 @@
|
||||
<yandex>
|
||||
<mqs>99999</mqs>
|
||||
</yandex>
|
@ -8,11 +8,11 @@ node2 = cluster.add_instance('node2', user_configs=['configs/config_env.xml'],
|
||||
env_variables={"MAX_QUERY_SIZE": "55555"})
|
||||
node3 = cluster.add_instance('node3', user_configs=['configs/config_zk.xml'], with_zookeeper=True)
|
||||
node4 = cluster.add_instance('node4', user_configs=['configs/config_incl.xml'],
|
||||
main_configs=['configs/max_query_size.xml']) # include value 77777
|
||||
main_configs=['configs/include_from_source.xml']) # include value 77777
|
||||
node5 = cluster.add_instance('node5', user_configs=['configs/config_allow_databases.xml'])
|
||||
node6 = cluster.add_instance('node6', user_configs=['configs/config_include_from_env.xml'],
|
||||
env_variables={"INCLUDE_FROM_ENV": "/etc/clickhouse-server/config.d/max_query_size.xml"},
|
||||
main_configs=['configs/max_query_size.xml'])
|
||||
env_variables={"INCLUDE_FROM_ENV": "/etc/clickhouse-server/config.d/include_from_source.xml"},
|
||||
main_configs=['configs/include_from_source.xml'])
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
@ -40,6 +40,13 @@ def test_config(start_cluster):
|
||||
|
||||
|
||||
def test_include_config(start_cluster):
|
||||
# <include incl="source tag" />
|
||||
assert node4.query("select 1")
|
||||
assert node4.query("select 1", user="user_1")
|
||||
assert node4.query("select 1", user="user_2")
|
||||
|
||||
# <include from_zk="zk path />
|
||||
assert node3.query("select 1")
|
||||
assert node3.query("select 1", user="user_1")
|
||||
assert node3.query("select 1", user="user_2")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user