Automatic style fix

This commit is contained in:
robot-clickhouse 2023-10-10 08:38:11 +00:00
parent 1f72bd85e9
commit 9640e09f38
2 changed files with 57 additions and 10 deletions

View File

@ -241,31 +241,69 @@ def check_postgresql_java_client_is_available(postgresql_java_client_id):
def check_rabbitmq_is_available(rabbitmq_id, cookie):
p = subprocess.Popen(
("docker", "exec", "-e", f"RABBITMQ_ERLANG_COOKIE={cookie}", "-i", rabbitmq_id, "rabbitmqctl", "await_startup"),
(
"docker",
"exec",
"-e",
f"RABBITMQ_ERLANG_COOKIE={cookie}",
"-i",
rabbitmq_id,
"rabbitmqctl",
"await_startup",
),
stdout=subprocess.PIPE,
)
p.communicate()
return p.returncode == 0
def rabbitmq_debuginfo(rabbitmq_id, cookie):
p = subprocess.Popen(
("docker", "exec", "-e", f"RABBITMQ_ERLANG_COOKIE={cookie}", "-i", rabbitmq_id, "rabbitmq-diagnostics", "status"),
(
"docker",
"exec",
"-e",
f"RABBITMQ_ERLANG_COOKIE={cookie}",
"-i",
rabbitmq_id,
"rabbitmq-diagnostics",
"status",
),
stdout=subprocess.PIPE,
)
p.communicate()
p = subprocess.Popen(
("docker", "exec", "-e", f"RABBITMQ_ERLANG_COOKIE={cookie}", "-i", rabbitmq_id, "rabbitmq-diagnostics", "listeners"),
(
"docker",
"exec",
"-e",
f"RABBITMQ_ERLANG_COOKIE={cookie}",
"-i",
rabbitmq_id,
"rabbitmq-diagnostics",
"listeners",
),
stdout=subprocess.PIPE,
)
p.communicate()
p = subprocess.Popen(
("docker", "exec", "-e", f"RABBITMQ_ERLANG_COOKIE={cookie}", "-i", rabbitmq_id, "rabbitmq-diagnostics", "environment"),
(
"docker",
"exec",
"-e",
f"RABBITMQ_ERLANG_COOKIE={cookie}",
"-i",
rabbitmq_id,
"rabbitmq-diagnostics",
"environment",
),
stdout=subprocess.PIPE,
)
p.communicate()
async def check_nats_is_available(nats_port, ssl_ctx=None):
nc = await nats_connect_ssl(
nats_port, user="click", password="house", ssl_ctx=ssl_ctx
@ -2252,9 +2290,13 @@ class ClickHouseCluster:
start = time.time()
while time.time() - start < timeout:
try:
if check_rabbitmq_is_available(self.rabbitmq_docker_id, self.rabbitmq_cookie):
if check_rabbitmq_is_available(
self.rabbitmq_docker_id, self.rabbitmq_cookie
):
logging.debug("RabbitMQ is available")
if enable_consistent_hash_plugin(self.rabbitmq_docker_id, self.rabbitmq_cookie):
if enable_consistent_hash_plugin(
self.rabbitmq_docker_id, self.rabbitmq_cookie
):
logging.debug("RabbitMQ consistent hash plugin is available")
return True
time.sleep(0.5)
@ -2272,7 +2314,6 @@ class ClickHouseCluster:
logging.debug("Unable to get logs from docker.")
raise Exception("Cannot wait RabbitMQ container")
def wait_nats_is_available(self, max_retries=5):
retries = 0
while True:

View File

@ -1582,7 +1582,9 @@ def test_rabbitmq_headers_exchange(rabbitmq_cluster):
num_tables_to_ignore = 2
for consumer_id in range(num_tables_to_ignore):
logging.debug(("Setting up table {}".format(consumer_id + num_tables_to_receive)))
logging.debug(
("Setting up table {}".format(consumer_id + num_tables_to_receive))
)
instance.query(
"""
DROP TABLE IF EXISTS test.headers_exchange_{0};
@ -1966,7 +1968,9 @@ def test_rabbitmq_restore_failed_connection_without_losses_1(rabbitmq_cluster):
kill_rabbitmq(rabbitmq_cluster.rabbitmq_docker_id)
time.sleep(4)
revive_rabbitmq(rabbitmq_cluster.rabbitmq_docker_id, rabbitmq_cluster.rabbitmq_cookie)
revive_rabbitmq(
rabbitmq_cluster.rabbitmq_docker_id, rabbitmq_cluster.rabbitmq_cookie
)
while True:
result = instance.query("SELECT count(DISTINCT key) FROM test.view")
@ -2041,7 +2045,9 @@ def test_rabbitmq_restore_failed_connection_without_losses_2(rabbitmq_cluster):
kill_rabbitmq(rabbitmq_cluster.rabbitmq_docker_id)
time.sleep(8)
revive_rabbitmq(rabbitmq_cluster.rabbitmq_docker_id, rabbitmq_cluster.rabbitmq_cookie)
revive_rabbitmq(
rabbitmq_cluster.rabbitmq_docker_id, rabbitmq_cluster.rabbitmq_cookie
)
# while int(instance.query('SELECT count() FROM test.view')) == 0:
# time.sleep(0.1)