Merge pull request #28066 from ClickHouse/fix_zookeeper_secure_test

Fix zookeeper secure client test
This commit is contained in:
Maksim Kita 2021-08-24 21:39:31 +03:00 committed by GitHub
commit 167d34051c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,3 @@
import threading
import os
from tempfile import NamedTemporaryFile
@ -35,18 +33,21 @@ def started_cluster():
# NOTE this test have to be ported to Keeper
def test_secure_connection(started_cluster):
assert node1.query("SELECT count() FROM system.zookeeper WHERE path = '/'") == '2\n'
assert node2.query("SELECT count() FROM system.zookeeper WHERE path = '/'") == '2\n'
# no asserts, connection works
node1.query("SELECT count() FROM system.zookeeper WHERE path = '/'")
node2.query("SELECT count() FROM system.zookeeper WHERE path = '/'")
kThreadsNumber = 16
kIterations = 100
threads = []
for _ in range(kThreadsNumber):
threads.append(threading.Thread(target=(lambda:
[node1.query("SELECT count() FROM system.zookeeper WHERE path = '/'") for _ in range(kIterations)])))
threads_number = 16
iterations = 100
threads = []
for thread in threads:
thread.start()
# just checking for race conditions
for _ in range(threads_number):
threads.append(threading.Thread(target=(lambda:
[node1.query("SELECT count() FROM system.zookeeper WHERE path = '/'") for _ in range(iterations)])))
for thread in threads:
thread.join()
for thread in threads:
thread.start()
for thread in threads:
thread.join()