Fixed unavailable test servers issue in test_storage_s3.

This commit is contained in:
Vladimir Chebotarev 2019-07-02 23:17:00 +00:00
parent 3e4af7b844
commit 8c4eb13be6

View File

@ -40,7 +40,17 @@ except ImportError:
from http.server import HTTPServer
localhost = '127.0.0.1'
def test_sophisticated_default(started_cluster):
instance = started_cluster.instances['dummy']
def GetCurrentIP():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
ip = s.getsockname()[0]
s.close()
return ip
localhost = GetCurrentIP()
def GetFreeTCPPorts(n):
result = []
@ -54,7 +64,6 @@ def GetFreeTCPPorts(n):
[ s.close() for s in sockets ]
return result
test_csv = os.path.join(os.path.dirname(sys.argv[0]), 'test.csv')
format = 'column1 UInt32, column2 UInt32, column3 UInt32'
values = '(1, 2, 3), (3, 2, 1), (78, 43, 45)'
other_values = '(1, 1, 1), (1, 1, 1), (11, 11, 11)'
@ -62,9 +71,6 @@ redirecting_host = localhost
redirecting_to_http_port, redirecting_to_https_port, preserving_data_port, redirecting_preserving_data_port = GetFreeTCPPorts(4)
bucket = 'abc'
def test_sophisticated_default(started_cluster):
instance = started_cluster.instances['dummy']
def run_query(query):
return instance.query(query)
@ -237,6 +243,7 @@ def test_sophisticated_default(started_cluster):
[ job.start() for job in jobs ]
try:
subprocess.check_call(['ss', '-an'])
for query in prepare_put_queries:
print(query)
run_query(query)