Skip to content

Commit 32aae17

Browse files
author
Ivan Lazarev
committedJun 29, 2022
[PBCKP-220] minor updates for gdb checks, checking CI tests
1 parent 7e16642 commit 32aae17

File tree

6 files changed

+33
-27
lines changed

6 files changed

+33
-27
lines changed
 

‎tests/archive.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ def test_pgpro434_4(self):
290290
Check pg_stop_backup_timeout, libpq-timeout requested.
291291
Fixed in commit d84d79668b0c139 and assert fixed by ptrack 1.7
292292
"""
293+
self._check_gdb_flag_or_skip_test()
294+
293295
fname = self.id().split('.')[3]
294296
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
295297
node = self.make_simple_node(

‎tests/delta.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,8 @@ def test_delta_vacuum_full(self):
472472
make node, make full and delta stream backups,
473473
restore them and check data correctness
474474
"""
475-
if not self.gdb:
476-
self.skipTest(
477-
"Specify PGPROBACKUP_GDB and build without "
478-
"optimizations for run this test"
479-
)
475+
self._check_gdb_flag_or_skip_test()
476+
480477
fname = self.id().split('.')[3]
481478
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
482479
node = self.make_simple_node(

‎tests/helpers/ptrack_helpers.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ def __init__(self, *args, **kwargs):
180180
self.test_env['LC_MESSAGES'] = 'C'
181181
self.test_env['LC_TIME'] = 'C'
182182

183-
self.gdb = 'PGPROBACKUP_GDB' in os.environ and \
184-
os.environ['PGPROBACKUP_GDB'] == 'ON'
183+
self.gdb = 'PGPROBACKUP_GDB' in self.test_env and \
184+
self.test_env['PGPROBACKUP_GDB'] == 'ON'
185185

186186
self.paranoia = 'PG_PROBACKUP_PARANOIA' in self.test_env and \
187187
self.test_env['PG_PROBACKUP_PARANOIA'] == 'ON'
@@ -810,6 +810,7 @@ def run_pb(self, command, asynchronous=False, gdb=False, old_binary=False, retur
810810
if self.verbose:
811811
print(self.cmd)
812812
if gdb:
813+
#TODO REVIEW XXX no self parameter
813814
return GDBobj([binary_path] + command, self.verbose)
814815
if asynchronous:
815816
return subprocess.Popen(
@@ -1861,8 +1862,15 @@ def compare_pgdata(self, original_pgdata, restored_pgdata, exclusion_dict = dict
18611862
self.assertFalse(fail, error_message)
18621863

18631864
def gdb_attach(self, pid):
1865+
#TODO REVIEW XXX no self parameter
18641866
return GDBobj([str(pid)], self.verbose, attach=True)
18651867

1868+
def _check_gdb_flag_or_skip_test(self):
1869+
if not self.gdb:
1870+
self.skipTest(
1871+
"Specify PGPROBACKUP_GDB and build without "
1872+
"optimizations for run this test"
1873+
)
18661874

18671875
class GdbException(Exception):
18681876
def __init__(self, message=False):
@@ -1877,6 +1885,11 @@ def __init__(self, cmd, verbose, attach=False):
18771885
self.verbose = verbose
18781886
self.output = ''
18791887

1888+
# Check gdb flag is set up
1889+
# if not self.gdb:
1890+
# raise GdbException("No `PGPROBACKUP_GDB=on` is set, "
1891+
# "test should call ProbackupTest::check_gdb_flag_or_skip_test() on its start "
1892+
# "and be skipped")
18801893
# Check gdb presense
18811894
try:
18821895
gdb_version, _ = subprocess.Popen(

‎tests/pgpro2068.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ def test_minrecpoint_on_replica(self):
1818
"""
1919
https://jira.postgrespro.ru/browse/PGPRO-2068
2020
"""
21+
self._check_gdb_flag_or_skip_test()
22+
2123
if not self.gdb:
2224
self.skipTest(
2325
"Specify PGPROBACKUP_GDB and build without "

‎tests/ptrack.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,8 @@ def test_ptrack_uncommitted_xact(self):
824824
def test_ptrack_vacuum_full(self):
825825
"""make node, make full and ptrack stream backups,
826826
restore them and check data correctness"""
827+
self._check_gdb_flag_or_skip_test()
828+
827829
backup_dir = os.path.join(self.tmp_path, module_name, self.fname, 'backup')
828830
node = self.make_simple_node(
829831
base_dir=os.path.join(module_name, self.fname, 'node'),

‎tests/replica.py

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -634,11 +634,8 @@ def test_replica_promote(self):
634634
def test_replica_stop_lsn_null_offset(self):
635635
"""
636636
"""
637-
if not self.gdb:
638-
self.skipTest(
639-
"Specify PGPROBACKUP_GDB and build without "
640-
"optimizations for run this test"
641-
)
637+
self._check_gdb_flag_or_skip_test()
638+
642639
fname = self.id().split('.')[3]
643640
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
644641
master = self.make_simple_node(
@@ -722,11 +719,8 @@ def test_replica_stop_lsn_null_offset(self):
722719
def test_replica_stop_lsn_null_offset_next_record(self):
723720
"""
724721
"""
725-
if not self.gdb:
726-
self.skipTest(
727-
"Specify PGPROBACKUP_GDB and build without "
728-
"optimizations for run this test"
729-
)
722+
self._check_gdb_flag_or_skip_test()
723+
730724
fname = self.id().split('.')[3]
731725
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
732726
master = self.make_simple_node(
@@ -828,6 +822,8 @@ def test_replica_stop_lsn_null_offset_next_record(self):
828822
def test_archive_replica_null_offset(self):
829823
"""
830824
"""
825+
self._check_gdb_flag_or_skip_test()
826+
831827
fname = self.id().split('.')[3]
832828
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
833829
master = self.make_simple_node(
@@ -998,11 +994,8 @@ def test_replica_toast(self):
998994
make archive master, take full and page archive backups from master,
999995
set replica, make archive backup from replica
1000996
"""
1001-
if not self.gdb:
1002-
self.skipTest(
1003-
"Specify PGPROBACKUP_GDB and build without "
1004-
"optimizations for run this test"
1005-
)
997+
self._check_gdb_flag_or_skip_test()
998+
1006999
fname = self.id().split('.')[3]
10071000
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
10081001
master = self.make_simple_node(
@@ -1104,11 +1097,8 @@ def test_replica_toast(self):
11041097
def test_start_stop_lsn_in_the_same_segno(self):
11051098
"""
11061099
"""
1107-
if not self.gdb:
1108-
self.skipTest(
1109-
"Specify PGPROBACKUP_GDB and build without "
1110-
"optimizations for run this test"
1111-
)
1100+
self._check_gdb_flag_or_skip_test()
1101+
11121102
fname = self.id().split('.')[3]
11131103
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
11141104
master = self.make_simple_node(

0 commit comments

Comments
 (0)