2020-09-03 13:53:34 +00:00
|
|
|
#!/usr/bin/env python3
|
2021-05-07 13:14:40 +00:00
|
|
|
import os
|
2020-09-03 13:53:34 +00:00
|
|
|
import sys
|
|
|
|
from testflows.core import *
|
|
|
|
|
|
|
|
append_path(sys.path, "..", "..")
|
|
|
|
|
|
|
|
from helpers.cluster import Cluster
|
|
|
|
from helpers.argparser import argparser
|
|
|
|
from ldap.authentication.requirements import *
|
|
|
|
|
|
|
|
# Cross-outs of known fails
|
|
|
|
xfails = {
|
2022-03-22 16:39:58 +00:00
|
|
|
"connection protocols/tls/tls_require_cert='try'": [
|
|
|
|
(Fail, "can't be tested with self-signed certificates")
|
|
|
|
],
|
|
|
|
"connection protocols/tls/tls_require_cert='demand'": [
|
|
|
|
(Fail, "can't be tested with self-signed certificates")
|
|
|
|
],
|
|
|
|
"connection protocols/starttls/tls_require_cert='try'": [
|
|
|
|
(Fail, "can't be tested with self-signed certificates")
|
|
|
|
],
|
|
|
|
"connection protocols/starttls/tls_require_cert='demand'": [
|
|
|
|
(Fail, "can't be tested with self-signed certificates")
|
|
|
|
],
|
|
|
|
"connection protocols/tls require cert default demand": [
|
|
|
|
(Fail, "can't be tested with self-signed certificates")
|
|
|
|
],
|
|
|
|
"connection protocols/starttls with custom port": [
|
|
|
|
(
|
|
|
|
Fail,
|
|
|
|
"it seems that starttls is not enabled by default on custom plain-text ports in LDAP server",
|
|
|
|
)
|
|
|
|
],
|
|
|
|
"connection protocols/tls cipher suite": [(Fail, "can't get it to work")],
|
2020-09-03 13:53:34 +00:00
|
|
|
}
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-09-03 13:53:34 +00:00
|
|
|
@TestFeature
|
|
|
|
@Name("authentication")
|
|
|
|
@ArgumentParser(argparser)
|
2022-03-22 16:39:58 +00:00
|
|
|
@Specifications(SRS_007_ClickHouse_Authentication_of_Users_via_LDAP)
|
|
|
|
@Requirements(RQ_SRS_007_LDAP_Authentication("1.0"))
|
2020-09-03 13:53:34 +00:00
|
|
|
@XFails(xfails)
|
2022-03-22 16:39:58 +00:00
|
|
|
def regression(
|
|
|
|
self, local, clickhouse_binary_path, clickhouse_version=None, stress=None
|
|
|
|
):
|
|
|
|
"""ClickHouse integration with LDAP regression module."""
|
2020-09-03 13:53:34 +00:00
|
|
|
nodes = {
|
|
|
|
"clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3"),
|
|
|
|
}
|
|
|
|
|
2022-02-11 01:08:41 +00:00
|
|
|
self.context.clickhouse_version = clickhouse_version
|
|
|
|
|
2021-05-10 20:59:47 +00:00
|
|
|
if stress is not None:
|
|
|
|
self.context.stress = stress
|
2022-02-11 01:08:41 +00:00
|
|
|
|
|
|
|
from platform import processor as current_cpu
|
|
|
|
|
|
|
|
folder_name = os.path.basename(current_dir())
|
2022-03-22 16:39:58 +00:00
|
|
|
if current_cpu() == "aarch64":
|
2022-02-11 01:08:41 +00:00
|
|
|
env = f"{folder_name}_env_arm64"
|
|
|
|
else:
|
|
|
|
env = f"{folder_name}_env"
|
2021-05-10 20:59:47 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
with Cluster(
|
|
|
|
local,
|
|
|
|
clickhouse_binary_path,
|
|
|
|
nodes=nodes,
|
|
|
|
docker_compose_project_dir=os.path.join(current_dir(), env),
|
|
|
|
) as cluster:
|
2020-09-03 13:53:34 +00:00
|
|
|
self.context.cluster = cluster
|
|
|
|
|
|
|
|
Scenario(run=load("ldap.authentication.tests.sanity", "scenario"))
|
|
|
|
Scenario(run=load("ldap.authentication.tests.multiple_servers", "scenario"))
|
|
|
|
Feature(run=load("ldap.authentication.tests.connections", "feature"))
|
|
|
|
Feature(run=load("ldap.authentication.tests.server_config", "feature"))
|
|
|
|
Feature(run=load("ldap.authentication.tests.user_config", "feature"))
|
|
|
|
Feature(run=load("ldap.authentication.tests.authentications", "feature"))
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
2020-09-03 13:53:34 +00:00
|
|
|
if main():
|
|
|
|
regression()
|