2023-06-09 15:18:46 +00:00
|
|
|
import pytest
|
|
|
|
from helpers.cluster import ClickHouseCluster
|
|
|
|
|
|
|
|
|
|
|
|
def start_clickhouse(config, err_msg):
|
|
|
|
cluster = ClickHouseCluster(__file__)
|
|
|
|
node = cluster.add_instance("node", main_configs=[config])
|
|
|
|
caught_exception = ""
|
|
|
|
try:
|
|
|
|
cluster.start()
|
|
|
|
except Exception as e:
|
|
|
|
caught_exception = str(e)
|
2023-07-20 14:18:32 +00:00
|
|
|
assert err_msg in caught_exception
|
2023-06-09 15:18:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_wrong_method():
|
2023-07-18 15:45:43 +00:00
|
|
|
start_clickhouse(
|
|
|
|
"configs/config_wrong_method.xml", "Wrong encryption method. Got WRONG"
|
|
|
|
)
|
2023-06-09 15:18:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_invalid_chars():
|
|
|
|
start_clickhouse(
|
|
|
|
"configs/config_invalid_chars.xml",
|
|
|
|
"Cannot read encrypted text, check for valid characters",
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-07-21 13:03:25 +00:00
|
|
|
def test_no_encryption_key():
|
2023-06-09 15:18:46 +00:00
|
|
|
start_clickhouse(
|
2023-07-21 13:31:42 +00:00
|
|
|
"configs/config_no_encryption_key.xml",
|
|
|
|
"There is no key 0 in config for AES_128_GCM_SIV encryption codec",
|
2023-06-09 15:18:46 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_subnodes():
|
2023-07-21 13:29:40 +00:00
|
|
|
start_clickhouse("configs/config_subnodes.xml", "cannot contain nested elements")
|