From adcb7590212b577943d3f1880cea4d9dc506818d Mon Sep 17 00:00:00 2001 From: Yaroslav Lobankov Date: Thu, 1 Sep 2022 13:04:25 +0300 Subject: [PATCH 1/7] Use only Unix sockets for admin console connection This patch makes test-run use only Unix sockets for admin console connection. The feature to use TCP sockets for it is dropped. Actually, admin console connection is a purely internal thing of test-run, and we can use what is more convenient for such a connection. Using only Unix sockets gives us significant advantages over TCP sockets like connection speed and eliminating issue with getting a free port for TCP connection. Part of #141 --- lib/preprocessor.py | 1 - lib/tarantool_server.py | 16 ++++++++-------- lib/test_suite.py | 1 - test/test-tarantool/suite.ini | 1 - test/unittest/suite.ini | 1 - 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/preprocessor.py b/lib/preprocessor.py index a2c1232b..56b688c1 100644 --- a/lib/preprocessor.py +++ b/lib/preprocessor.py @@ -259,7 +259,6 @@ def server_create(self, ctype, sname, opts): if 'rpl_master' in opts: temp.rpl_master = self.servers[opts['rpl_master']] temp.vardir = self.suite_ini['vardir'] - temp.use_unix_sockets = self.suite_ini['use_unix_sockets'] temp.use_unix_sockets_iproto = \ self.suite_ini['use_unix_sockets_iproto'] temp.inspector_port = int(self.suite_ini.get( diff --git a/lib/tarantool_server.py b/lib/tarantool_server.py index 4eba32c2..d338cb9a 100644 --- a/lib/tarantool_server.py +++ b/lib/tarantool_server.py @@ -10,6 +10,7 @@ import signal import subprocess import sys +import textwrap import time import yaml @@ -655,12 +656,15 @@ def __init__(self, _ini=None, test_suite=None): 'lua_libs': [], 'valgrind': False, 'vardir': None, - 'use_unix_sockets': False, 'use_unix_sockets_iproto': False, 'tarantool_port': None, 'strace': False } ini.update(_ini) + if ini.get('use_unix_sockets') is not None: + qa_notice(textwrap.fill('The "use_unix_sockets" option is defined ' + 'in suite.ini, but it was dropped in favor ' + 'of permanent using Unix sockets')) Server.__init__(self, ini, test_suite) self.testdir = os.path.abspath(os.curdir) self.sourcedir = os.path.abspath(os.path.join(os.path.basename( @@ -677,7 +681,6 @@ def __init__(self, _ini=None, test_suite=None): self.lua_libs = ini['lua_libs'] self.valgrind = ini['valgrind'] self.strace = ini['strace'] - self.use_unix_sockets = ini['use_unix_sockets'] self.use_unix_sockets_iproto = ini['use_unix_sockets_iproto'] self._start_against_running = ini['tarantool_port'] self.crash_detector = None @@ -762,12 +765,9 @@ def install(self, silent=True): self.cleanup() self.copy_files() - if self.use_unix_sockets: - path = os.path.join(self.vardir, self.name + ".c") - warn_unix_socket(path) - self._admin = path - else: - self._admin = find_port() + path = os.path.join(self.vardir, self.name + ".c") + warn_unix_socket(path) + self._admin = path if self.use_unix_sockets_iproto: path = os.path.join(self.vardir, self.name + ".i") diff --git a/lib/test_suite.py b/lib/test_suite.py index 0d9e1f65..d2934c7e 100644 --- a/lib/test_suite.py +++ b/lib/test_suite.py @@ -140,7 +140,6 @@ def __init__(self, suite_path, args): # use old format dictionary self.fragile['tests'] = self.ini['fragile'] - self.parse_bool_opt('use_unix_sockets', False) self.parse_bool_opt('use_unix_sockets_iproto', False) self.parse_bool_opt('is_parallel', False) self.parse_bool_opt('show_reproduce_content', True) diff --git a/test/test-tarantool/suite.ini b/test/test-tarantool/suite.ini index a477019b..3b4a7f16 100644 --- a/test/test-tarantool/suite.ini +++ b/test/test-tarantool/suite.ini @@ -2,5 +2,4 @@ core = tarantool description = tarantool tests script = box.lua -use_unix_sockets = True config = engine.cfg diff --git a/test/unittest/suite.ini b/test/unittest/suite.ini index 4c53f4f8..a3ae6a79 100644 --- a/test/unittest/suite.ini +++ b/test/unittest/suite.ini @@ -2,5 +2,4 @@ core = tarantool description = unit tests script = box-cc0544b6afd1.lua -use_unix_sockets = True use_unix_sockets_iproto = True From dfb61b7c468332c83e44d41ad17bfec976b49514 Mon Sep 17 00:00:00 2001 From: Yaroslav Lobankov Date: Wed, 24 Aug 2022 20:02:25 +0300 Subject: [PATCH 2/7] Free port auto resolving for TarantoolServer This change replaces manual choosing an iproto port for TarantoolServer by the auto resolving mechanism. In two words, test-run always provides '127.0.0.1:0' as a value for LISTEN env variable that is used in a lua file to start a tarantool instance. In this way, the port will be picked automatically, and we are getting the real value of it via the admin console by executing `box.info.listen` that is available for tarantool version >= 2.4.1, and special lua script intended for tarantool version < 2.4.1. Part of #141 --- lib/preprocessor.py | 13 ++++--- lib/tarantool_server.py | 81 +++++++++++++++++++++++++++++++++++------ 2 files changed, 78 insertions(+), 16 deletions(-) diff --git a/lib/preprocessor.py b/lib/preprocessor.py index 56b688c1..06aaca26 100644 --- a/lib/preprocessor.py +++ b/lib/preprocessor.py @@ -59,7 +59,7 @@ def __init__(self, suite_ini, default_server, create_server, params={}, self.curcon = [self.connections['default']] nmsp = Namespace() setattr(nmsp, 'admin', default_server.admin.uri) - setattr(nmsp, 'listen', default_server.iproto.uri) + setattr(nmsp, 'listen', default_server.listen_uri) setattr(self.environ, 'default', nmsp) # for propagating 'current_test' to non-default servers self.default_server_no_connect = kwargs.get( @@ -282,13 +282,13 @@ def server_create(self, ctype, sname, opts): copy_to )) nmsp = Namespace() - setattr(nmsp, 'admin', temp.admin.port) - setattr(nmsp, 'listen', temp.iproto.port) + setattr(nmsp, 'admin', temp.admin.uri) + setattr(nmsp, 'listen', temp.listen_uri) if temp.rpl_master: - setattr(nmsp, 'master', temp.rpl_master.iproto.port) + setattr(nmsp, 'master', temp.rpl_master.iproto.uri) setattr(self.environ, sname, nmsp) if 'return_listen_uri' in opts and opts['return_listen_uri'] == 'True': - return self.servers[sname].iproto.uri + return self.servers[sname].listen_uri def server_deploy(self, ctype, sname, opts): self.servers[sname].install() @@ -342,6 +342,9 @@ def server_restart(self, ctype, sname, opts): # remove proxy self.server_stop('stop', 'proxy', {}) + def server_get_iproto_uri(self, ctype, sname, opts): + return self.servers[sname].iproto.uri + def server(self, ctype, sname, opts): attr = 'server_%s' % ctype if hasattr(self, attr): diff --git a/lib/tarantool_server.py b/lib/tarantool_server.py index d338cb9a..4b62a37c 100644 --- a/lib/tarantool_server.py +++ b/lib/tarantool_server.py @@ -38,7 +38,6 @@ from lib.server import DEFAULT_SNAPSHOT_NAME from lib.test import Test from lib.utils import bytes_to_str -from lib.utils import find_port from lib.utils import extract_schema_from_snapshot from lib.utils import format_process from lib.utils import safe_makedirs @@ -598,7 +597,7 @@ def _admin(self, port): del self.admin if not hasattr(self, 'tests_type'): self.tests_type = 'lua' - self.admin = CON_SWITCH[self.tests_type]('localhost', port) + self.admin = CON_SWITCH[self.tests_type](self.localhost, port) @property def _iproto(self): @@ -610,7 +609,7 @@ def _iproto(self): def _iproto(self, port): if hasattr(self, 'iproto'): del self.iproto - self.iproto = BoxConnection('localhost', port) + self.iproto = BoxConnection(self.localhost, port) @property def log_des(self): @@ -672,9 +671,8 @@ def __init__(self, _ini=None, test_suite=None): self.name = "default" self.conf = {} self.status = None - # -----InitBasicVars-----# self.core = ini['core'] - + self.localhost = '127.0.0.1' self.gdb = ini['gdb'] self.lldb = ini['lldb'] self.script = ini['script'] @@ -686,10 +684,8 @@ def __init__(self, _ini=None, test_suite=None): self.crash_detector = None # use this option with inspector to enable crashes in test self.crash_enabled = False - # set in from a test let test-run ignore server's crashes self.crash_expected = False - # filled in {Test,FuncTest,LuaTest,PythonTest}.execute() # or passed through execfile() for PythonTest self.current_test = None @@ -772,9 +768,10 @@ def install(self, silent=True): if self.use_unix_sockets_iproto: path = os.path.join(self.vardir, self.name + ".i") warn_unix_socket(path) + self.listen_uri = path self._iproto = path else: - self._iproto = find_port() + self.listen_uri = self.localhost + ':0' # these sockets will be created by tarantool itself path = os.path.join(self.vardir, self.name + '.control') @@ -872,7 +869,7 @@ def start(self, silent=True, wait=True, wait_load=True, rais=True, args=[], color_log(prefix_each_line(' | ', self.version()) + '\n', schema='version') - os.putenv("LISTEN", self.iproto.uri) + os.putenv("LISTEN", self.listen_uri) os.putenv("ADMIN", self.admin.uri) if self.rpl_master: os.putenv("MASTER", self.rpl_master.iproto.uri) @@ -933,7 +930,12 @@ def start(self, silent=True, wait=True, wait_load=True, rais=True, args=[], port = self.admin.port self.admin.disconnect() - self.admin = CON_SWITCH[self.tests_type]('localhost', port) + self.admin = CON_SWITCH[self.tests_type](self.localhost, port) + + if not self.use_unix_sockets_iproto: + if wait and wait_load and not self.crash_expected: + self._iproto = self.get_iproto_port() + self.status = 'started' # Verify that the schema actually was not upgraded. @@ -1144,7 +1146,7 @@ def wait_until_started(self, wait_load=True, deadline=None): self.wait_load(deadline) while not deadline or time.time() < deadline: try: - temp = AdminConnection('localhost', self.admin.port) + temp = AdminConnection(self.localhost, self.admin.port) if not wait_load: ans = yaml.safe_load(temp.execute("2 + 2")) color_log(" | Successful connection check; don't wait for " @@ -1270,3 +1272,60 @@ def wait_lsn(self, node_id, lsn): def get_log(self): return TarantoolLog(self.logfile).positioning() + + def get_iproto_port(self): + # Check the `box.cfg.listen` option, if it wasn't defined, just return. + res = yaml.safe_load(self.admin('box.cfg.listen', silent=True))[0] + if res is None: + return + + # If `box.info.listen` (available for tarantool version >= 2.4.1) gives + # `nil`, use a simple script intended for tarantool version < 2.4.1 to + # get the listening socket of the instance. First, the script catches + # both server (listening) and client (sending) sockets (they usually + # occur when starting an instance as a replica). Then it finds the + # listening socket among caught sockets. + script = """ + local ffi = require('ffi') + local socket = require('socket') + local uri = require('uri') + local res = box.info.listen + if res then + local listen_uri = uri.parse(res) + return {{host = listen_uri.host, port = listen_uri.service}} + else + res = {{}} + local val = ffi.new('int[1]') + local len = ffi.new('size_t[1]', ffi.sizeof('int')) + for fd = 0, 65535 do + local addrinfo = socket.internal.name(fd) + local is_matched = addrinfo ~= nil and + addrinfo.host == '{localhost}' and + addrinfo.family == 'AF_INET' and + addrinfo.type == 'SOCK_STREAM' and + addrinfo.protocol == 'tcp' and + type(addrinfo.port) == 'number' + if is_matched then + local lvl = socket.internal.SOL_SOCKET + ffi.C.getsockopt(fd, lvl, + socket.internal.SO_OPT[lvl].SO_REUSEADDR.iname, + val, len) + if val[0] > 0 then + table.insert(res, addrinfo) + end + end + end + if #res ~= 1 then + error(("Zero or more than one listening TCP sockets: %s") + :format(#res)) + end + return {{host = res[1].host, port = res[1].port}} + end + """.format(localhost=self.localhost) + res = yaml.safe_load(self.admin(script, silent=True))[0] + if res.get('error'): + color_stdout("Failed to get iproto port: {}\n".format(res['error']), + schema='error') + raise TarantoolStartError(self.name) + + return int(res['port']) From 6477a296f46b689dcd6f9df099a778994b8faa10 Mon Sep 17 00:00:00 2001 From: Yaroslav Lobankov Date: Thu, 1 Sep 2022 14:54:57 +0300 Subject: [PATCH 3/7] Free port auto resolving for AppServer This change replaces manual choosing a free iproto port for AppServer by the auto resolving mechanism. In two words, test-run always provides '127.0.0.1:0' as a value for LISTEN env variable that is used in a lua test script. In this way, the iproto port will be picked automatically, but if the test needs the real value of the port, it has to execute `box.info.listen` for tarantool version >= 2.4.1, or other lua code for tarantool version < 2.4.1. Part of #141 --- lib/app_server.py | 8 ++++---- test/test-app/suite.ini | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/app_server.py b/lib/app_server.py index c67adc19..56ce8135 100644 --- a/lib/app_server.py +++ b/lib/app_server.py @@ -19,7 +19,6 @@ from lib.tarantool_server import Test from lib.tarantool_server import TarantoolServer from lib.tarantool_server import TarantoolStartError -from lib.utils import find_port from lib.utils import format_process from lib.utils import signame from lib.utils import warn_unix_socket @@ -33,7 +32,7 @@ def timeout_handler(server_process, test_timeout): def run_server(execs, cwd, server, logfile, retval, test_id): - os.putenv("LISTEN", server.iproto) + os.putenv("LISTEN", server.listen_uri) server.process = Popen(execs, stdout=PIPE, stderr=PIPE, cwd=cwd) sampler.register_process(server.process.pid, test_id, server.name) test_timeout = Options().args.test_timeout @@ -113,6 +112,7 @@ def __init__(self, _ini=None, test_suite=None): self.lua_libs = ini['lua_libs'] self.name = 'app_server' self.process = None + self.localhost = '127.0.0.1' self.use_unix_sockets_iproto = ini['use_unix_sockets_iproto'] @property @@ -156,9 +156,9 @@ def deploy(self, vardir=None, silent=True, need_init=True): if self.use_unix_sockets_iproto: path = os.path.join(self.vardir, self.name + ".i") warn_unix_socket(path) - self.iproto = path + self.listen_uri = path else: - self.iproto = str(find_port()) + self.listen_uri = self.localhost + ':0' shutil.copy(os.path.join(self.TEST_RUN_DIR, 'test_run.lua'), self.vardir) diff --git a/test/test-app/suite.ini b/test/test-app/suite.ini index 7f0e64fd..ce994696 100644 --- a/test/test-app/suite.ini +++ b/test/test-app/suite.ini @@ -2,4 +2,3 @@ core = app description = application tests is_parallel = True -use_unix_sockets_iproto = True From 7e9f01692171b3804fa5e736226abdb3aea4e2e9 Mon Sep 17 00:00:00 2001 From: Yaroslav Lobankov Date: Mon, 12 Sep 2022 00:48:39 +0300 Subject: [PATCH 4/7] Free port auto resolving for TarantoolInspector Part of #141 --- lib/inspector.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/inspector.py b/lib/inspector.py index 9733cc1f..8171098d 100644 --- a/lib/inspector.py +++ b/lib/inspector.py @@ -7,7 +7,6 @@ from gevent.server import StreamServer from lib.utils import bytes_to_str -from lib.utils import find_port from lib.utils import prefix_each_line from lib.utils import str_to_bytes from lib.colorer import color_stdout @@ -52,10 +51,6 @@ class TarantoolInspector(StreamServer): """ def __init__(self, host, port): - # When specific port range was acquired for current worker, don't allow - # OS set port for us that isn't from specified range. - if port == 0: - port = find_port() super(TarantoolInspector, self).__init__((host, port)) self.parser = None From b36799c1071057aeff1cfce0d38dcdc27a16c5fd Mon Sep 17 00:00:00 2001 From: Yaroslav Lobankov Date: Thu, 1 Sep 2022 19:47:14 +0300 Subject: [PATCH 5/7] Eliminate TcpPortDispatcher and port ranges Now this functionality is not needed anymore due to added free port auto resolving mechanism. Part of #141 --- dispatcher.py | 45 ++++----------------------------------------- 1 file changed, 4 insertions(+), 41 deletions(-) diff --git a/dispatcher.py b/dispatcher.py index 5da908d6..686257b5 100644 --- a/dispatcher.py +++ b/dispatcher.py @@ -46,35 +46,6 @@ from listeners import StatisticsWatcher -class TcpPortDispatcher: - """ Helper class holds available and occupied TCP port ranges. This ranges - intended to distributes between workers. - """ - def __init__(self, range_count): - lowest_port = 3000 - highest_port = 59999 - port_count = highest_port - lowest_port + 1 - range_size = port_count // range_count - - self.available_ranges = set() - for i in range(range_count): - start_port = lowest_port + i * range_size - end_port = start_port + range_size - 1 - tcp_port_range = (start_port, end_port) - self.available_ranges.add(tcp_port_range) - - self.acquired_ranges = dict() - - def acquire_range(self, _id): - tcp_port_range = self.available_ranges.pop() - self.acquired_ranges[_id] = tcp_port_range - return tcp_port_range - - def release_range(self, _id): - tcp_port_range = self.acquired_ranges.pop(_id) - self.available_ranges.add(tcp_port_range) - - class Dispatcher: """Run specified count of worker processes ('max_workers_cnt' arg), pass task IDs (via 'task_queue'), receive results and output (via @@ -136,8 +107,6 @@ def __init__(self, task_groups, max_workers_cnt, randomize): self.worker_id_to_pid = dict() self.randomize = randomize - self.tcp_port_dispatcher = TcpPortDispatcher( - range_count=max_workers_cnt) def terminate_all_workers(self): for process in self.processes: @@ -235,10 +204,7 @@ def add_worker(self): # find_nonempty_task_queue_disp() if self.workers_cnt >= self.max_workers_cnt: return False - tcp_port_range = self.tcp_port_dispatcher.acquire_range( - self.worker_next_id) - process = task_queue_disp.add_worker(self.worker_next_id, - tcp_port_range) + process = task_queue_disp.add_worker(self.worker_next_id) self.processes.append(process) self.pids.append(process.pid) self.pid_to_worker_id[process.pid] = self.worker_next_id @@ -255,7 +221,6 @@ def del_worker(self, worker_id): task_queue_disp = self.get_task_queue_disp(worker_id) task_queue_disp.del_worker(worker_id) self.workers_cnt -= 1 - self.tcp_port_dispatcher.release_range(worker_id) self.pids.remove(pid) del self.worker_id_to_pid[worker_id] @@ -412,24 +377,22 @@ def __init__(self, key, task_group, randomize): self.done = False self.done_task_ids = set() - def _run_worker(self, worker_id, tcp_port_range): + def _run_worker(self, worker_id): """Entry function for worker processes.""" os.environ['TEST_RUN_WORKER_ID'] = str(worker_id) - os.environ['TEST_RUN_TCP_PORT_START'] = str(tcp_port_range[0]) - os.environ['TEST_RUN_TCP_PORT_END'] = str(tcp_port_range[1]) color_stdout.queue = self.result_queue worker = self.gen_worker(worker_id) sampler.set_queue(self.result_queue, worker_id, worker.name) worker.run_all(self.task_queue, self.result_queue) - def add_worker(self, worker_id, tcp_port_range): + def add_worker(self, worker_id): # Note: each of our workers should consume only one None, but for the # case of abnormal circumstances we listen for processes termination # (method 'check_for_dead_processes') and for time w/o output from # workers (class 'HangWatcher'). self.task_queue.put(None) # 'stop worker' marker - entry = functools.partial(self._run_worker, worker_id, tcp_port_range) + entry = functools.partial(self._run_worker, worker_id) self.worker_ids.add(worker_id) process = multiprocessing.Process(target=entry) From f91c0ddaaf4c25e68a28d0bebcf7adced22c9e5d Mon Sep 17 00:00:00 2001 From: Yaroslav Lobankov Date: Mon, 12 Sep 2022 00:50:22 +0300 Subject: [PATCH 6/7] Eliminate find_port() and check_port() functions Now these functions are not needed anymore due to added free port auto resolving mechanism. Closes #141 --- lib/utils.py | 59 --------------------------------- test/unittest/test_lib_utils.py | 20 +---------- 2 files changed, 1 insertion(+), 78 deletions(-) diff --git a/lib/utils.py b/lib/utils.py index 1eed5861..03423768 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -3,13 +3,11 @@ import sys import collections import signal -import random import fcntl import difflib import time import json import subprocess -from gevent import socket from lib.colorer import color_stdout try: @@ -85,63 +83,6 @@ def print_tail_n(filename, num_lines=None): color_stdout(line, schema='tail') -def check_port(port, rais=True, ipv4=True, ipv6=True): - """ True -- it's possible to listen on this port for TCP/IPv4 or TCP/IPv6 - connections (UNIX Sockets in case of file path). False -- otherwise. - """ - try: - if isinstance(port, integer_types): - if ipv4: - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.bind(('127.0.0.1', port)) - sock.listen(5) - sock.close() - if ipv6: - sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) - sock.bind(('::1', port)) - sock.listen(5) - sock.close() - else: - sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - sock.connect(port) - except socket.error: - if rais: - raise RuntimeError( - "The server is already running on port {0}".format(port)) - return False - return True - - -# A list of ports used so far. Avoid reusing ports -# to reduce race conditions between starting and stopping servers. -# We're using tarantoolctl for instance control, and it reports -# a successful stop of the server before it really closes its -# network sockets -ports = {} - - -is_ipv6_supported = check_port(port=0, rais=False, ipv4=False, ipv6=True) - - -def find_port(): - global ports - start_port = int(os.environ.get('TEST_RUN_TCP_PORT_START', '3000')) - end_port = int(os.environ.get('TEST_RUN_TCP_PORT_END', '65535')) - port = random.randrange(start_port, end_port + 1) - - while port <= end_port: - is_free = check_port(port, False, ipv4=True, ipv6=is_ipv6_supported) - if port not in ports and is_free: - ports[port] = True - return port - port += 1 - - # We've made a full circle, clear the list of used ports and start - # from scratch - ports = {} - return find_port() - - def find_in_path(name): path = os.curdir + os.pathsep + os.environ["PATH"] for _dir in path.split(os.pathsep): diff --git a/test/unittest/test_lib_utils.py b/test/unittest/test_lib_utils.py index 8fe1ff72..cfdba8b8 100644 --- a/test/unittest/test_lib_utils.py +++ b/test/unittest/test_lib_utils.py @@ -1,32 +1,14 @@ -import socket import unittest -from hypothesis import given, settings -from hypothesis.strategies import integers - import lib.utils as utils + class TestUtils(unittest.TestCase): def test_extract_schema_from_snapshot(self): snapshot_path = 'test/unittest/00000000000000000003.snap' v = utils.extract_schema_from_snapshot(snapshot_path) self.assertEqual(v, (2, 3, 1)) - @settings(max_examples=5) - @given(port=integers(65100, 65535)) - def test_check_port(self, port): - def open_socket(p): - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.bind(('localhost', p)) - s.listen(0) - return s - status = utils.check_port(port, rais=False, ipv4=True, ipv6=False) - self.assertEqual(status, True) - s = open_socket(port) - status = utils.check_port(port, rais=False, ipv4=True, ipv6=False) - s.close() - self.assertEqual(status, False) - if __name__ == "__main__": unittest.main() From dcc23f60a1ac8503b232a265deaa834b6bade6e4 Mon Sep 17 00:00:00 2001 From: Yaroslav Lobankov Date: Fri, 2 Sep 2022 18:39:39 +0300 Subject: [PATCH 7/7] Facility to use Unix sockets for box connection Some tests may require this feature if they are switched to using Unix sockets for such a connection in the future. Anyway, this change doesn't make worse. --- lib/box_connection.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/box_connection.py b/lib/box_connection.py index 6a3617a7..45f1ddef 100644 --- a/lib/box_connection.py +++ b/lib/box_connection.py @@ -23,12 +23,14 @@ import errno import ctypes +import re import socket from lib.tarantool_connection import TarantoolConnection # monkey patch tarantool and msgpack from lib.utils import check_libs +from lib.utils import warn_unix_socket check_libs() from tarantool import Connection as tnt_connection # noqa: E402 @@ -41,6 +43,10 @@ class BoxConnection(TarantoolConnection): def __init__(self, host, port): super(BoxConnection, self).__init__(host, port) + if self.host == 'unix/' or re.search(r'^/', str(self.port)): + warn_unix_socket(self.port) + host = None + self.py_con = tnt_connection(host, port, connect_now=False, socket_timeout=100) self.py_con.error = False