From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp52.i.mail.ru (smtp52.i.mail.ru [94.100.177.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id CC71D469710 for ; Thu, 21 May 2020 09:20:22 +0300 (MSK) Date: Thu, 21 May 2020 09:19:58 +0300 From: Alexander Turenko Message-ID: <20200521061958.wsmyaubx2yqpgpge@tkn_work_nb> References: <5e8736537209a6b2d45d47a15edb22d8e6a09f59.1589443360.git.avtikhon@tarantool.org> <20200521031558.3ty5x7cgcp6ffaky@tkn_work_nb> <20200521043020.GA30264@hpalx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200521043020.GA30264@hpalx> Subject: Re: [Tarantool-patches] [PATCH v1] test: set unix sockets for iproto at core = app List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Alexander V. Tikhonov" Cc: Oleg Piskunov , tarantool-patches@dev.tarantool.org 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.