Fixing procedure of getting log file size in LDAP tests.

Increasing default timeouts.
This commit is contained in:
Vitaliy Zakaznikov 2020-10-25 09:40:19 -04:00
parent 46ef8617c0
commit 4bcbcfed1f
2 changed files with 10 additions and 10 deletions

View File

@ -47,7 +47,7 @@ ASCII_CHARS = string.ascii_lowercase + string.ascii_uppercase + string.digits
def randomword(length, chars=ASCII_CHARS): def randomword(length, chars=ASCII_CHARS):
return ''.join(random.choice(chars) for i in range(length)) return ''.join(random.choice(chars) for i in range(length))
def restart(node=None, safe=False, timeout=20): def restart(node=None, safe=False, timeout=60):
"""Restart ClickHouse server and wait for config to be reloaded. """Restart ClickHouse server and wait for config to be reloaded.
""" """
with When("I restart ClickHouse server node"): with When("I restart ClickHouse server node"):
@ -62,7 +62,7 @@ def restart(node=None, safe=False, timeout=20):
with And("getting current log size"): with And("getting current log size"):
logsize = \ logsize = \
node.command("ls -s --block-size=1 /var/log/clickhouse-server/clickhouse-server.log").output.split(" ")[ node.command("stat --format=%s /var/log/clickhouse-server/clickhouse-server.log").output.split(" ")[
0].strip() 0].strip()
with And("restarting ClickHouse server"): with And("restarting ClickHouse server"):
@ -78,7 +78,7 @@ def restart(node=None, safe=False, timeout=20):
f"ConfigReloader: Loaded config '/etc/clickhouse-server/config.xml', performed update on configuration", f"ConfigReloader: Loaded config '/etc/clickhouse-server/config.xml', performed update on configuration",
timeout=timeout) timeout=timeout)
def add_config(config, timeout=20, restart=False): def add_config(config, timeout=60, restart=False):
"""Add dynamic configuration file to ClickHouse. """Add dynamic configuration file to ClickHouse.
:param node: node :param node: node
@ -108,7 +108,7 @@ def add_config(config, timeout=20, restart=False):
with And("I get the current log size"): with And("I get the current log size"):
logsize = \ logsize = \
node.command("ls -s --block-size=1 /var/log/clickhouse-server/clickhouse-server.log").output.split(" ")[ node.command("stat --format=%s /var/log/clickhouse-server/clickhouse-server.log").output.split(" ")[
0].strip() 0].strip()
with And("I restart ClickHouse to apply the config changes"): with And("I restart ClickHouse to apply the config changes"):
@ -189,7 +189,7 @@ def create_ldap_servers_config_content(servers, config_d_dir="/etc/clickhouse-se
@contextmanager @contextmanager
def ldap_servers(servers, config_d_dir="/etc/clickhouse-server/config.d", config_file="ldap_servers.xml", def ldap_servers(servers, config_d_dir="/etc/clickhouse-server/config.d", config_file="ldap_servers.xml",
timeout=20, restart=False): timeout=60, restart=False):
"""Add LDAP servers configuration. """Add LDAP servers configuration.
""" """
config = create_ldap_servers_config_content(servers, config_d_dir, config_file) config = create_ldap_servers_config_content(servers, config_d_dir, config_file)
@ -236,7 +236,7 @@ def add_users_identified_with_ldap(*users):
@contextmanager @contextmanager
def ldap_authenticated_users(*users, config_d_dir="/etc/clickhouse-server/users.d", def ldap_authenticated_users(*users, config_d_dir="/etc/clickhouse-server/users.d",
config_file=None, timeout=20, restart=True, config=None, rbac=False): config_file=None, timeout=60, restart=True, config=None, rbac=False):
"""Add LDAP authenticated users. """Add LDAP authenticated users.
""" """
if rbac: if rbac:
@ -248,7 +248,7 @@ def ldap_authenticated_users(*users, config_d_dir="/etc/clickhouse-server/users.
config = create_ldap_users_config_content(*users, config_d_dir=config_d_dir, config_file=config_file) config = create_ldap_users_config_content(*users, config_d_dir=config_d_dir, config_file=config_file)
return add_config(config, restart=restart) return add_config(config, restart=restart)
def invalid_server_config(servers, message=None, tail=13, timeout=20): def invalid_server_config(servers, message=None, tail=13, timeout=60):
"""Check that ClickHouse errors when trying to load invalid LDAP servers configuration file. """Check that ClickHouse errors when trying to load invalid LDAP servers configuration file.
""" """
node = current().context.node node = current().context.node
@ -277,7 +277,7 @@ def invalid_server_config(servers, message=None, tail=13, timeout=20):
with By("removing the config file", description=config.path): with By("removing the config file", description=config.path):
node.command(f"rm -rf {config.path}", exitcode=0) node.command(f"rm -rf {config.path}", exitcode=0)
def invalid_user_config(servers, config, message=None, tail=13, timeout=20): def invalid_user_config(servers, config, message=None, tail=13, timeout=60):
"""Check that ClickHouse errors when trying to load invalid LDAP users configuration file. """Check that ClickHouse errors when trying to load invalid LDAP users configuration file.
""" """
node = current().context.node node = current().context.node

View File

@ -129,7 +129,7 @@ def create_entries_ldap_external_user_directory_config_content(entries, config_d
return Config(content, path, name, uid, "config.xml") return Config(content, path, name, uid, "config.xml")
def invalid_ldap_external_user_directory_config(server, roles, message, tail=20, timeout=20, config=None): def invalid_ldap_external_user_directory_config(server, roles, message, tail=20, timeout=60, config=None):
"""Check that ClickHouse errors when trying to load invalid LDAP external user directory """Check that ClickHouse errors when trying to load invalid LDAP external user directory
configuration file. configuration file.
""" """
@ -181,7 +181,7 @@ def invalid_ldap_external_user_directory_config(server, roles, message, tail=20,
@contextmanager @contextmanager
def ldap_external_user_directory(server, roles, config_d_dir="/etc/clickhouse-server/config.d", def ldap_external_user_directory(server, roles, config_d_dir="/etc/clickhouse-server/config.d",
config_file=None, timeout=20, restart=True, config=None): config_file=None, timeout=60, restart=True, config=None):
"""Add LDAP external user directory. """Add LDAP external user directory.
""" """
if config_file is None: if config_file is None: