1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-20 11:34:51 +02:00

tests: set env for run_binary

This commit is contained in:
Grigory Smolkin 2021-04-26 12:52:37 +03:00
parent 1c860ff9bc
commit 23b00b1ddf
2 changed files with 10 additions and 4 deletions

View File

@ -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(

View File

@ -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: