Reorganizing ldap tests.

This commit is contained in:
Vitaliy Zakaznikov 2020-09-03 15:53:34 +02:00
parent 9b4cd06051
commit af23a27f9f
63 changed files with 84 additions and 52 deletions

View File

@ -120,6 +120,18 @@
<!-- Path to folder where users and roles created by SQL commands are stored. -->
<access_control_path>/var/lib/clickhouse/access/</access_control_path>
<!-- Sources to read users, roles, access rights, profiles of settings, quotas. -->
<user_directories>
<users_xml>
<!-- Path to configuration file with predefined users. -->
<path>users.xml</path>
</users_xml>
<local_directory>
<!-- Path to folder where users created by SQL commands are stored. -->
<path>/var/lib/clickhouse/access/</path>
</local_directory>
</user_directories>
<!-- Path to configuration file with users, access rights, profiles of settings, quotas. -->
<users_config>users.xml</users_config>

View File

@ -0,0 +1,54 @@
#!/usr/bin/env python3
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 = {
"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")]
}
@TestFeature
@Name("authentication")
@ArgumentParser(argparser)
@Requirements(
RQ_SRS_007_LDAP_Authentication("1.0")
)
@XFails(xfails)
def regression(self, local, clickhouse_binary_path):
"""ClickHouse integration with LDAP regression module.
"""
nodes = {
"clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3"),
}
with Cluster(local, clickhouse_binary_path, nodes=nodes) as cluster:
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"))
if main():
regression()

View File

@ -4,8 +4,8 @@ import random
from multiprocessing.dummy import Pool
from testflows.core import *
from testflows.asserts import error
from ldap.tests.common import *
from ldap.requirements import *
from ldap.authentication.tests.common import *
from ldap.authentication.requirements import *
servers = {
"openldap1": {

View File

@ -172,7 +172,7 @@ def create_ldap_users_config_content(*users, config_d_dir="/etc/clickhouse-serve
return Config(content, path, name, uid, "users.xml")
def add_users_identified_with_ldap(*users):
"""Add one or more users that are identified via
"""Add one or more users that are identified via
an ldap server using RBAC.
"""
node = current().context.node

View File

@ -1,8 +1,8 @@
from testflows.core import *
from testflows.asserts import error
from ldap.tests.common import login
from ldap.requirements import *
from ldap.authentication.tests.common import login
from ldap.authentication.requirements import *
@TestScenario
@Requirements(

View File

@ -1,8 +1,8 @@
from testflows.core import *
from testflows.asserts import error
from ldap.tests.common import login
from ldap.requirements import RQ_SRS_007_LDAP_Authentication_MultipleServers
from ldap.authentication.tests.common import login
from ldap.authentication.requirements import RQ_SRS_007_LDAP_Authentication_MultipleServers
@TestScenario
@Name("multiple servers")

View File

@ -1,7 +1,7 @@
from testflows.core import *
from testflows.asserts import error
from ldap.tests.common import add_user_to_ldap, delete_user_from_ldap
from ldap.authentication.tests.common import add_user_to_ldap, delete_user_from_ldap
@TestScenario
@Name("sanity")

View File

@ -1,7 +1,7 @@
from testflows.core import *
from ldap.tests.common import *
from ldap.requirements import *
from ldap.authentication.tests.common import *
from ldap.authentication.requirements import *
@TestScenario
@Requirements(

View File

@ -2,8 +2,8 @@ import xml.etree.ElementTree as xmltree
from testflows.core import *
from ldap.tests.common import *
from ldap.requirements import *
from ldap.authentication.tests.common import *
from ldap.authentication.requirements import *
@TestScenario
@Requirements(

View File

@ -2,53 +2,19 @@
import sys
from testflows.core import *
append_path(sys.path, "..")
append_path(sys.path, "..")
from helpers.cluster import Cluster
from helpers.argparser import argparser
from ldap.requirements import *
# Cross-outs of known fails
xfails = {
"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")]
}
@TestFeature
@Name("ldap authentication")
@TestModule
@Name("ldap")
@ArgumentParser(argparser)
@Requirements(
RQ_SRS_007_LDAP_Authentication("1.0")
)
@XFails(xfails)
def regression(self, local, clickhouse_binary_path):
"""ClickHouse integration with LDAP regression module.
"""ClickHouse LDAP integration regression module.
"""
nodes = {
"clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3"),
}
with Cluster(local, clickhouse_binary_path, nodes=nodes) as cluster:
self.context.cluster = cluster
args = {"local": local, "clickhouse_binary_path": clickhouse_binary_path}
Scenario(run=load("ldap.tests.sanity", "scenario"))
Scenario(run=load("ldap.tests.multiple_servers", "scenario"))
Feature(run=load("ldap.tests.connections", "feature"))
Feature(run=load("ldap.tests.server_config", "feature"))
Feature(run=load("ldap.tests.user_config", "feature"))
Feature(run=load("ldap.tests.authentications", "feature"))
Feature(test=load("ldap.authentication.regression", "regression"))(**args)
if main():
regression()