From 23b00b1ddfec8a262b200228fc06f8e77bb9e2c8 Mon Sep 17 00:00:00 2001 From: Grigory Smolkin Date: Mon, 26 Apr 2021 12:52:37 +0300 Subject: [PATCH] tests: set env for run_binary --- tests/archive.py | 4 +++- tests/helpers/ptrack_helpers.py | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/archive.py b/tests/archive.py index 7f11b808..c506ccbf 100644 --- a/tests/archive.py +++ b/tests/archive.py @@ -2030,7 +2030,9 @@ class ArchiveTest(ProbackupTest, unittest.TestCase): if self.archive_compress and node.major_version >= 10: cmdline += ['-Z', '1'] - pg_receivexlog = self.run_binary(cmdline, asynchronous=True) + env = self.test_env + env["PGAPPNAME"] = app_name + pg_receivexlog = self.run_binary(cmdline, asynchronous=True, env) if pg_receivexlog.returncode: self.assertFalse( diff --git a/tests/helpers/ptrack_helpers.py b/tests/helpers/ptrack_helpers.py index d0652788..b0400a72 100644 --- a/tests/helpers/ptrack_helpers.py +++ b/tests/helpers/ptrack_helpers.py @@ -779,7 +779,11 @@ class ProbackupTest(object): except subprocess.CalledProcessError as e: raise ProbackupException(e.output.decode('utf-8'), self.cmd) - def run_binary(self, command, asynchronous=False): + def run_binary(self, command, asynchronous=False, env=None): + + if not env: + env = self.test_env + if self.verbose: print([' '.join(map(str, command))]) try: @@ -789,13 +793,13 @@ class ProbackupTest(object): stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - env=self.test_env + env=env ) else: self.output = subprocess.check_output( command, stderr=subprocess.STDOUT, - env=self.test_env + env=env ).decode('utf-8') return self.output except subprocess.CalledProcessError as e: