code review changes

This commit is contained in:
Ilya Golshtein 2020-09-16 00:54:58 +03:00
parent bcdb2277bd
commit 75836acddc
5 changed files with 16 additions and 50 deletions

View File

@ -45,13 +45,6 @@ def _create_env_file(path, variables, fname=DEFAULT_ENV_NAME):
f.write("=".join([var, value]) + "\n")
return full_path
def remove_files(files):
for a_file in files:
try:
os.remove(a_file)
except:
pass
def subprocess_check_call(args):
# Uncomment for debugging
# print('run:', ' ' . join(args))
@ -625,17 +618,10 @@ class ClickHouseCluster:
self.wait_schema_registry_to_start(120)
if self.with_kerberized_kafka and self.base_kerberized_kafka_cmd:
env_var = {}
env_var['KERBERIZED_KAFKA_DIR'] = instance.path + '/'
# different docker_compose versions look for .env in different places
# -- env-file too recent to rely on it
files_to_cleanup = []
files_to_cleanup.append(_create_env_file(self.base_dir, env_var, ".env"))
files_to_cleanup.append(_create_env_file(os.getcwd(), env_var, ".env"))
subprocess_check_call(self.base_kerberized_kafka_cmd + common_opts + ['--renew-anon-volumes'])
env = os.environ.copy()
env['KERBERIZED_KAFKA_DIR'] = instance.path + '/'
subprocess.check_call(self.base_kerberized_kafka_cmd + common_opts + ['--renew-anon-volumes'], env=env)
self.kerberized_kafka_docker_id = self.get_instance_docker_id('kerberized_kafka1')
remove_files(files_to_cleanup)
if self.with_rabbitmq and self.base_rabbitmq_cmd:
subprocess_check_call(self.base_rabbitmq_cmd + common_opts + ['--renew-anon-volumes'])
self.rabbitmq_docker_id = self.get_instance_docker_id('rabbitmq1')

View File

@ -1,3 +1,5 @@
# docker build -t arenadata/kdc .
FROM centos:6.6
# old OS to make is faster and smaller

View File

@ -1,25 +0,0 @@
<?xml version="1.0"?>
<yandex>
<profiles>
<default>
<!--stream_poll_timeout_ms>1</stream_poll_timeout_ms>
<stream_flush_interval_ms>100</stream_flush_interval_ms-->
</default>
</profiles>
<users>
<default>
<password></password>
<networks incl="networks" replace="replace">
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
</default>
</users>
<quotas>
<default>
</default>
</quotas>
</yandex>

View File

@ -1,16 +1,16 @@
#!/bin/bash
[[ "TRACE" ]] && set -x
set -x # trace
: ${REALM:=TEST.CLICKHOUSE.TECH}
: ${DOMAIN_REALM:=test.clickhouse.tech}
: ${KERB_MASTER_KEY:=masterkey}
: ${KERB_ADMIN_USER:=admin}
: ${KERB_ADMIN_PASS:=admin}
: "${REALM:=TEST.CLICKHOUSE.TECH}"
: "${DOMAIN_REALM:=test.clickhouse.tech}"
: "${KERB_MASTER_KEY:=masterkey}"
: "${KERB_ADMIN_USER:=admin}"
: "${KERB_ADMIN_PASS:=admin}"
create_config() {
: ${KDC_ADDRESS:=$(hostname -f)}
: "${KDC_ADDRESS:=$(hostname -f)}"
cat>/etc/krb5.conf<<EOF
[logging]
@ -129,4 +129,4 @@ main() {
}
[[ "$0" == "$BASH_SOURCE" ]] && main "$@"
[[ "$0" == "${BASH_SOURCE[0]}" ]] && main "$@"

View File

@ -22,6 +22,7 @@ cluster = ClickHouseCluster(__file__)
instance = cluster.add_instance('instance',
main_configs=['configs/kafka.xml', 'configs/log_conf.xml' ],
with_kerberized_kafka=True,
clickhouse_path_dir="clickhouse_path"
)
kafka_id = '' # instance.cluster.kafka_docker_id
@ -135,6 +136,8 @@ def test_kafka_json_as_string_no_kdc(kafka_cluster):
assert TSV(result) == TSV(expected)
assert instance.contains_in_log("StorageKafka (kafka_no_kdc): Nothing to commit")
assert instance.contains_in_log("Ticket expired")
assert instance.contains_in_log("Kerberos ticket refresh failed")
if __name__ == '__main__':