Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: "Alexander V. Tikhonov" <avtikhon@tarantool.org>
Cc: Oleg Piskunov <o.piskunov@tarantool.org>,
	tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v1] test: set unix sockets for iproto at core = app
Date: Thu, 21 May 2020 09:19:58 +0300	[thread overview]
Message-ID: <20200521061958.wsmyaubx2yqpgpge@tkn_work_nb> (raw)
In-Reply-To: <20200521043020.GA30264@hpalx>

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.

  reply	other threads:[~2020-05-21  6:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14  8:06 Alexander V. Tikhonov
2020-05-15 16:27 ` Sergey Bronnikov
2020-05-21  3:15 ` Alexander Turenko
2020-05-21  4:30   ` Alexander V. Tikhonov
2020-05-21  6:19     ` Alexander Turenko [this message]
2020-05-21  7:59       ` Alexander V. Tikhonov
2020-05-21 14:05         ` Alexander Turenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200521061958.wsmyaubx2yqpgpge@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=avtikhon@tarantool.org \
    --cc=o.piskunov@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1] test: set unix sockets for iproto at core = app' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox