Skip to content

Commit 6477a29

Browse files
committed
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
1 parent dfb61b7 commit 6477a29

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/app_server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from lib.tarantool_server import Test
2020
from lib.tarantool_server import TarantoolServer
2121
from lib.tarantool_server import TarantoolStartError
22-
from lib.utils import find_port
2322
from lib.utils import format_process
2423
from lib.utils import signame
2524
from lib.utils import warn_unix_socket
@@ -33,7 +32,7 @@ def timeout_handler(server_process, test_timeout):
3332

3433

3534
def run_server(execs, cwd, server, logfile, retval, test_id):
36-
os.putenv("LISTEN", server.iproto)
35+
os.putenv("LISTEN", server.listen_uri)
3736
server.process = Popen(execs, stdout=PIPE, stderr=PIPE, cwd=cwd)
3837
sampler.register_process(server.process.pid, test_id, server.name)
3938
test_timeout = Options().args.test_timeout
@@ -113,6 +112,7 @@ def __init__(self, _ini=None, test_suite=None):
113112
self.lua_libs = ini['lua_libs']
114113
self.name = 'app_server'
115114
self.process = None
115+
self.localhost = '127.0.0.1'
116116
self.use_unix_sockets_iproto = ini['use_unix_sockets_iproto']
117117

118118
@property
@@ -156,9 +156,9 @@ def deploy(self, vardir=None, silent=True, need_init=True):
156156
if self.use_unix_sockets_iproto:
157157
path = os.path.join(self.vardir, self.name + ".i")
158158
warn_unix_socket(path)
159-
self.iproto = path
159+
self.listen_uri = path
160160
else:
161-
self.iproto = str(find_port())
161+
self.listen_uri = self.localhost + ':0'
162162
shutil.copy(os.path.join(self.TEST_RUN_DIR, 'test_run.lua'),
163163
self.vardir)
164164

test/test-app/suite.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
core = app
33
description = application tests
44
is_parallel = True
5-
use_unix_sockets_iproto = True

0 commit comments

Comments
 (0)