[Tarantool-patches] [PATCH v1] test: set unix sockets for iproto at core = app

Alexander Turenko alexander.turenko at tarantool.org
Thu May 21 09:19:58 MSK 2020


On Thu, May 21, 2020 at 07:30:20AM +0300, Alexander V. Tikhonov wrote:
> Hi Alexander, thanks a lot for the review, I'll try to find the other
> way to fix it. Unfortunately the patch you suggested at the end was the
> same that I've started from, please check:
> 
> https://github.com/tarantool/tarantool/commit/ee080600df32f177dcdd5432217d081d3efc22aa
> 
> but in this way the tests still fail like I showed at the issue:
> 
> https://github.com/tarantool/tarantool/issues/4459#issuecomment-628430495
> 
> that is why I had to find some other way in addition to the fix.

os.putenv() from a non-default server (say, 'session_storage' instance)
rewrites LISTEN environment variable within the same process, where
AppServer is run. But AppServer is not like TarantoolServer: it spawns a
new child process (tarantool) for each test.

We can save necessary port/path and put it to environment just before
spawning a new process:

diff --git a/lib/app_server.py b/lib/app_server.py
index c2d2ea9..2cb8a87 100644
--- a/lib/app_server.py
+++ b/lib/app_server.py
@@ -19,6 +19,7 @@ from test import TestRunGreenlet, TestExecutionError
 
 
 def run_server(execs, cwd, server, logfile, retval):
+    os.putenv("LISTEN", server.iproto)
     server.process = Popen(execs, stdout=PIPE, stderr=PIPE, cwd=cwd)
     stdout, stderr = server.process.communicate()
     sys.stdout.write(stdout)
@@ -108,9 +109,9 @@ class AppServer(Server):
         if self.use_unix_sockets_iproto:
             path = os.path.join(self.vardir, self.name + ".socket-iproto")
             warn_unix_socket(path)
-            os.putenv("LISTEN", path)
+            self.iproto = path
         else:
-            os.putenv("LISTEN", str(find_port()))
+            self.iproto = str(find_port())
         shutil.copy(os.path.join(self.TEST_RUN_DIR, 'test_run.lua'),
                     self.vardir)

WBR, Alexander Turenko.


More information about the Tarantool-patches mailing list