Added FT testcase

This commit is contained in:
HeenaBansal2009 2022-07-21 19:46:36 -07:00
parent d67e061915
commit 06e8b78efa
3 changed files with 72 additions and 12 deletions

View File

@ -323,12 +323,16 @@ void LocalServer::setupUsers()
auto & access_control = global_context->getAccessControl();
access_control.setNoPasswordAllowed(config().getBool("allow_no_password", true));
access_control.setPlaintextPasswordAllowed(config().getBool("allow_plaintext_password", true));
if (config().has("users_config") || config().has("config-file") || fs::exists("config.xml"))
if (config().has("config-file") || fs::exists("config.xml"))
{
String config_path = config().getString("config-file","");
bool has_user_directories = config().has("user_directories");
const auto config_dir = std::filesystem::path{config_path}.remove_filename().string();
String users_config_path = config().getString("users_config","");
if (users_config_path.empty() && !has_user_directories)
users_config = getConfigurationFromXMLString(minimal_default_user_xml);
else
{
if (users_config_path.empty())
{
if (!has_user_directories)
@ -343,6 +347,7 @@ void LocalServer::setupUsers()
const auto loaded_config = config_processor.loadConfig();
users_config = loaded_config.configuration;
}
}
else
users_config = getConfigurationFromXMLString(minimal_default_user_xml);
if (users_config)

View File

@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -e
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
echo "<?xml version="1.0"?>
<clickhouse>
<logger>
<level>trace</level>
<console>true</console>
</logger>
<tcp_port>9000</tcp_port>
<path>./</path>
<mark_cache_size>0</mark_cache_size>
<user_directories>
<users_xml>
<!-- Path to configuration file with predefined users. -->
<path>users.xml</path>
</users_xml>
</user_directories>
</clickhouse>" > $CUR_DIR/config.xml
echo "<clickhouse>
<profiles>
<default></default>
</profiles>
<users>
<default>
<password></password>
<networks>
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
</default>
</users>
<quotas>
<default></default>
</quotas>
</clickhouse>" > $CUR_DIR/users.xml
local_opts=(
"--config-file=$CUR_DIR/config.xml"
"--send_logs_level=none")
${CLICKHOUSE_LOCAL} "${local_opts[@]}" --query 'Select 1' | grep -v -e 'Processing configuration file'
rm -rf $CUR_DIR/users.xml
rm -rf $CUR_DIR/config.xml