mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
fix check_black
This commit is contained in:
parent
f0a4009f60
commit
7d1b3f84d0
@ -18,13 +18,14 @@ node = cluster.add_instance(
|
|||||||
"configs/cert.xml",
|
"configs/cert.xml",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
PASS_PHRASE_TEMPLATE='''<privateKeyPassphraseHandler>
|
PASS_PHRASE_TEMPLATE="""<privateKeyPassphraseHandler>
|
||||||
<name>KeyFileHandler</name>
|
<name>KeyFileHandler</name>
|
||||||
<options>
|
<options>
|
||||||
<password>{pass_phrase}</password>
|
<password>{pass_phrase}</password>
|
||||||
</options>
|
</options>
|
||||||
</privateKeyPassphraseHandler>
|
</privateKeyPassphraseHandler>
|
||||||
'''
|
"""
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module", autouse=True)
|
@pytest.fixture(scope="module", autouse=True)
|
||||||
def started_cluster():
|
def started_cluster():
|
||||||
@ -61,14 +62,15 @@ def change_config_to_key(name, pass_phrase=""):
|
|||||||
</openSSL>
|
</openSSL>
|
||||||
</clickhouse>
|
</clickhouse>
|
||||||
EOF""".format(
|
EOF""".format(
|
||||||
cur_name=name,
|
cur_name=name, pass_phrase=pass_phrase
|
||||||
pass_phrase=pass_phrase
|
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
node.query("SYSTEM RELOAD CONFIG")
|
node.query("SYSTEM RELOAD CONFIG")
|
||||||
|
|
||||||
def check_certificate_switch(first, second, pass_phrase_first="", pass_phrase_second=""):
|
def check_certificate_switch(
|
||||||
|
first, second, pass_phrase_first="", pass_phrase_second=""
|
||||||
|
):
|
||||||
# Set first key
|
# Set first key
|
||||||
change_config_to_key(first, pass_phrase_first)
|
change_config_to_key(first, pass_phrase_first)
|
||||||
|
|
||||||
@ -79,9 +81,7 @@ def check_certificate_switch(first, second, pass_phrase_first="", pass_phrase_se
|
|||||||
"curl",
|
"curl",
|
||||||
"--silent",
|
"--silent",
|
||||||
"--cacert",
|
"--cacert",
|
||||||
"/etc/clickhouse-server/config.d/{cur_name}.crt".format(
|
"/etc/clickhouse-server/config.d/{cur_name}.crt".format(cur_name=first),
|
||||||
cur_name=first
|
|
||||||
),
|
|
||||||
"https://localhost:8443/",
|
"https://localhost:8443/",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -97,9 +97,7 @@ def check_certificate_switch(first, second, pass_phrase_first="", pass_phrase_se
|
|||||||
"curl",
|
"curl",
|
||||||
"--silent",
|
"--silent",
|
||||||
"--cacert",
|
"--cacert",
|
||||||
"/etc/clickhouse-server/config.d/{cur_name}.crt".format(
|
"/etc/clickhouse-server/config.d/{cur_name}.crt".format(cur_name=second),
|
||||||
cur_name=second
|
|
||||||
),
|
|
||||||
"https://localhost:8443/",
|
"https://localhost:8443/",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -144,14 +142,19 @@ def check_certificate_switch(first, second, pass_phrase_first="", pass_phrase_se
|
|||||||
except:
|
except:
|
||||||
assert True
|
assert True
|
||||||
|
|
||||||
|
|
||||||
def test_first_than_second_cert():
|
def test_first_than_second_cert():
|
||||||
"""Consistently set first key and check that only it will be accepted, then repeat same for second key."""
|
"""Consistently set first key and check that only it will be accepted, then repeat same for second key."""
|
||||||
check_certificate_switch("first", "second")
|
check_certificate_switch("first", "second")
|
||||||
|
|
||||||
|
|
||||||
def test_ECcert_reload():
|
def test_ECcert_reload():
|
||||||
'''Check EC certificate'''
|
"""Check EC certificate"""
|
||||||
check_certificate_switch("first", "ECcert")
|
check_certificate_switch("first", "ECcert")
|
||||||
|
|
||||||
|
|
||||||
def test_cert_with_pass_phrase():
|
def test_cert_with_pass_phrase():
|
||||||
pass_phrase_for_cert = PASS_PHRASE_TEMPLATE.format(pass_phrase="test")
|
pass_phrase_for_cert = PASS_PHRASE_TEMPLATE.format(pass_phrase="test")
|
||||||
check_certificate_switch("first", "WithPassPhrase", pass_phrase_second=pass_phrase_for_cert)
|
check_certificate_switch(
|
||||||
|
"first", "WithPassPhrase", pass_phrase_second=pass_phrase_for_cert
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user