1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-07-17 07:22:20 +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: if self.archive_compress and node.major_version >= 10:
cmdline += ['-Z', '1'] 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: if pg_receivexlog.returncode:
self.assertFalse( self.assertFalse(

View File

@ -779,7 +779,11 @@ class ProbackupTest(object):
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
raise ProbackupException(e.output.decode('utf-8'), self.cmd) 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: if self.verbose:
print([' '.join(map(str, command))]) print([' '.join(map(str, command))])
try: try:
@ -789,13 +793,13 @@ class ProbackupTest(object):
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
env=self.test_env env=env
) )
else: else:
self.output = subprocess.check_output( self.output = subprocess.check_output(
command, command,
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
env=self.test_env env=env
).decode('utf-8') ).decode('utf-8')
return self.output return self.output
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e: