Skip to content

Commit deebb59

Browse files
committed
Merge with main
2 parents 2621724 + b4268f8 commit deebb59

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
readme = f.read()
2828

2929
setup(
30-
version='1.10.2',
30+
version='1.10.0',
3131
name='testgres',
3232
packages=['testgres', 'testgres.operations', 'testgres.helpers'],
3333
description='Testing utility for PostgreSQL and its extensions',

testgres/node.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ def set_auto_conf(self, options, config='postgresql.auto.conf', rm_options={}):
16411641

16421642
self.os_ops.write(path, auto_conf, truncate=True)
16431643

1644-
def upgrade_from(self, old_node):
1644+
def upgrade_from(self, old_node, options=None):
16451645
"""
16461646
Upgrade this node from an old node using pg_upgrade.
16471647
@@ -1654,6 +1654,9 @@ def upgrade_from(self, old_node):
16541654
if not os.path.exists(self.data_dir):
16551655
self.init()
16561656

1657+
if not options:
1658+
options = []
1659+
16571660
pg_upgrade_binary = self._get_bin_path("pg_upgrade")
16581661

16591662
if not os.path.exists(pg_upgrade_binary):
@@ -1668,6 +1671,7 @@ def upgrade_from(self, old_node):
16681671
"--old-port", str(old_node.port),
16691672
"--new-port", str(self.port),
16701673
]
1674+
upgrade_command += options
16711675

16721676
return self.os_ops.exec_command(upgrade_command)
16731677

testgres/operations/remote_ops.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
import subprocess
44
import tempfile
55
import platform
6+
<<<<<<< HEAD
67
import time
8+
=======
9+
>>>>>>> master
710

811
# we support both pg8000 and psycopg2
912
try:

testgres/plugins/pg_probackup2/pg_probackup2/app.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def __init__(self, test_class: unittest.TestCase,
5656
self.verbose = init_params.verbose
5757
self.archive_compress = init_params.archive_compress
5858
self.test_class.output = None
59+
self.execution_time = None
5960

6061
def run(self, command, gdb=False, old_binary=False, return_id=True, env=None,
6162
skip_log_directory=False, expect_error=False, use_backup_dir=True):
@@ -113,16 +114,17 @@ def run(self, command, gdb=False, old_binary=False, return_id=True, env=None,
113114
cmdline = ['gdbserver'] + ['localhost:' + str(gdb_port)] + cmdline
114115
print("pg_probackup gdb suspended, waiting gdb connection on localhost:{0}".format(gdb_port))
115116

117+
start_time = time.time()
116118
self.test_class.output = subprocess.check_output(
117119
cmdline,
118120
stderr=subprocess.STDOUT,
119121
env=env
120122
).decode('utf-8', errors='replace')
123+
end_time = time.time()
124+
self.execution_time = end_time - start_time
125+
121126
if command[0] == 'backup' and return_id:
122-
# return backup ID
123-
for line in self.test_class.output.splitlines():
124-
if 'INFO: Backup' and 'completed' in line:
125-
result = line.split()[2]
127+
result = self.get_backup_id()
126128
else:
127129
result = self.test_class.output
128130
if expect_error is True:
@@ -139,6 +141,19 @@ def run(self, command, gdb=False, old_binary=False, return_id=True, env=None,
139141
else:
140142
raise ProbackupException(self.test_class.output, self.test_class.cmd)
141143

144+
def get_backup_id(self):
145+
if init_params.major_version > 2:
146+
pattern = re.compile(r"Backup (.*) completed successfully.")
147+
for line in self.test_class.output.splitlines():
148+
match = pattern.search(line)
149+
if match:
150+
return match.group(1)
151+
else:
152+
for line in self.test_class.output.splitlines():
153+
if 'INFO: Backup' and 'completed' in line:
154+
return line.split()[2]
155+
return None
156+
142157
def init(self, options=None, old_binary=False, skip_log_directory=False, expect_error=False, use_backup_dir=True):
143158
if options is None:
144159
options = []

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy