1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-04-07 07:19:51 +02:00

[PBCKP-220] minor updates for gdb checks, checking CI tests

This commit is contained in:
Ivan Lazarev 2022-06-30 02:28:29 +03:00
parent 7e16642b66
commit 32aae17928
6 changed files with 33 additions and 27 deletions

View File

@ -290,6 +290,8 @@ class ArchiveTest(ProbackupTest, unittest.TestCase):
Check pg_stop_backup_timeout, libpq-timeout requested.
Fixed in commit d84d79668b0c139 and assert fixed by ptrack 1.7
"""
self._check_gdb_flag_or_skip_test()
fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
node = self.make_simple_node(

View File

@ -472,11 +472,8 @@ class DeltaTest(ProbackupTest, unittest.TestCase):
make node, make full and delta stream backups,
restore them and check data correctness
"""
if not self.gdb:
self.skipTest(
"Specify PGPROBACKUP_GDB and build without "
"optimizations for run this test"
)
self._check_gdb_flag_or_skip_test()
fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
node = self.make_simple_node(

View File

@ -180,8 +180,8 @@ class ProbackupTest(object):
self.test_env['LC_MESSAGES'] = 'C'
self.test_env['LC_TIME'] = 'C'
self.gdb = 'PGPROBACKUP_GDB' in os.environ and \
os.environ['PGPROBACKUP_GDB'] == 'ON'
self.gdb = 'PGPROBACKUP_GDB' in self.test_env and \
self.test_env['PGPROBACKUP_GDB'] == 'ON'
self.paranoia = 'PG_PROBACKUP_PARANOIA' in self.test_env and \
self.test_env['PG_PROBACKUP_PARANOIA'] == 'ON'
@ -810,6 +810,7 @@ class ProbackupTest(object):
if self.verbose:
print(self.cmd)
if gdb:
#TODO REVIEW XXX no self parameter
return GDBobj([binary_path] + command, self.verbose)
if asynchronous:
return subprocess.Popen(
@ -1861,8 +1862,15 @@ class ProbackupTest(object):
self.assertFalse(fail, error_message)
def gdb_attach(self, pid):
#TODO REVIEW XXX no self parameter
return GDBobj([str(pid)], self.verbose, attach=True)
def _check_gdb_flag_or_skip_test(self):
if not self.gdb:
self.skipTest(
"Specify PGPROBACKUP_GDB and build without "
"optimizations for run this test"
)
class GdbException(Exception):
def __init__(self, message=False):
@ -1877,6 +1885,11 @@ class GDBobj(ProbackupTest):
self.verbose = verbose
self.output = ''
# Check gdb flag is set up
# if not self.gdb:
# raise GdbException("No `PGPROBACKUP_GDB=on` is set, "
# "test should call ProbackupTest::check_gdb_flag_or_skip_test() on its start "
# "and be skipped")
# Check gdb presense
try:
gdb_version, _ = subprocess.Popen(

View File

@ -18,6 +18,8 @@ class BugTest(ProbackupTest, unittest.TestCase):
"""
https://jira.postgrespro.ru/browse/PGPRO-2068
"""
self._check_gdb_flag_or_skip_test()
if not self.gdb:
self.skipTest(
"Specify PGPROBACKUP_GDB and build without "

View File

@ -824,6 +824,8 @@ class PtrackTest(ProbackupTest, unittest.TestCase):
def test_ptrack_vacuum_full(self):
"""make node, make full and ptrack stream backups,
restore them and check data correctness"""
self._check_gdb_flag_or_skip_test()
backup_dir = os.path.join(self.tmp_path, module_name, self.fname, 'backup')
node = self.make_simple_node(
base_dir=os.path.join(module_name, self.fname, 'node'),

View File

@ -634,11 +634,8 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
def test_replica_stop_lsn_null_offset(self):
"""
"""
if not self.gdb:
self.skipTest(
"Specify PGPROBACKUP_GDB and build without "
"optimizations for run this test"
)
self._check_gdb_flag_or_skip_test()
fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
master = self.make_simple_node(
@ -722,11 +719,8 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
def test_replica_stop_lsn_null_offset_next_record(self):
"""
"""
if not self.gdb:
self.skipTest(
"Specify PGPROBACKUP_GDB and build without "
"optimizations for run this test"
)
self._check_gdb_flag_or_skip_test()
fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
master = self.make_simple_node(
@ -828,6 +822,8 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
def test_archive_replica_null_offset(self):
"""
"""
self._check_gdb_flag_or_skip_test()
fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
master = self.make_simple_node(
@ -998,11 +994,8 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
make archive master, take full and page archive backups from master,
set replica, make archive backup from replica
"""
if not self.gdb:
self.skipTest(
"Specify PGPROBACKUP_GDB and build without "
"optimizations for run this test"
)
self._check_gdb_flag_or_skip_test()
fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
master = self.make_simple_node(
@ -1104,11 +1097,8 @@ class ReplicaTest(ProbackupTest, unittest.TestCase):
def test_start_stop_lsn_in_the_same_segno(self):
"""
"""
if not self.gdb:
self.skipTest(
"Specify PGPROBACKUP_GDB and build without "
"optimizations for run this test"
)
self._check_gdb_flag_or_skip_test()
fname = self.id().split('.')[3]
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
master = self.make_simple_node(