Content-Length: 2118 | pFad | http://github.com/postgrespro/testgres/pull/126.patch
thub.com
From c92e32a0f45921fd19202945bdd77f7d052fbf42 Mon Sep 17 00:00:00 2001
From: vshepard
Date: Thu, 30 May 2024 11:07:37 +0200
Subject: [PATCH] Add parsing backup_id in run app.py
---
.../plugins/pg_probackup2/pg_probackup2/app.py | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/testgres/plugins/pg_probackup2/pg_probackup2/app.py b/testgres/plugins/pg_probackup2/pg_probackup2/app.py
index 1ab71109..19f612e0 100644
--- a/testgres/plugins/pg_probackup2/pg_probackup2/app.py
+++ b/testgres/plugins/pg_probackup2/pg_probackup2/app.py
@@ -119,10 +119,7 @@ def run(self, command, gdb=False, old_binary=False, return_id=True, env=None,
env=env
).decode('utf-8', errors='replace')
if command[0] == 'backup' and return_id:
- # return backup ID
- for line in self.test_class.output.splitlines():
- if 'INFO: Backup' and 'completed' in line:
- result = line.split()[2]
+ result = self.get_backup_id()
else:
result = self.test_class.output
if expect_error is True:
@@ -139,6 +136,19 @@ def run(self, command, gdb=False, old_binary=False, return_id=True, env=None,
else:
raise ProbackupException(self.test_class.output, self.test_class.cmd)
+ def get_backup_id(self):
+ if init_params.major_version > 2:
+ pattern = re.compile(r"Backup (.*) completed successfully.")
+ for line in self.test_class.output.splitlines():
+ match = pattern.search(line)
+ if match:
+ return match.group(1)
+ else:
+ for line in self.test_class.output.splitlines():
+ if 'INFO: Backup' and 'completed' in line:
+ return line.split()[2]
+ return None
+
def init(self, options=None, old_binary=False, skip_log_directory=False, expect_error=False, use_backup_dir=True):
if options is None:
options = []
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/postgrespro/testgres/pull/126.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy