Skip to content

[PBCKP-220] fix PGPROBAKUP_GDB=ON check #502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[PBCKP-220] minor updates for gdb checks, checking CI tests
  • Loading branch information
Ivan Lazarev committed Jun 29, 2022
commit 32aae17928d165be7a8a19b015b87f8b885bc5dd
2 changes: 2 additions & 0 deletions tests/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ def test_pgpro434_4(self):
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(
Expand Down
7 changes: 2 additions & 5 deletions tests/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,8 @@ def test_delta_vacuum_full(self):
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(
Expand Down
17 changes: 15 additions & 2 deletions tests/helpers/ptrack_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ def __init__(self, *args, **kwargs):
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'
Expand Down Expand Up @@ -810,6 +810,7 @@ def run_pb(self, command, asynchronous=False, gdb=False, old_binary=False, retur
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(
Expand Down Expand Up @@ -1861,8 +1862,15 @@ def compare_pgdata(self, original_pgdata, restored_pgdata, exclusion_dict = dict
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):
Expand All @@ -1877,6 +1885,11 @@ def __init__(self, cmd, verbose, attach=False):
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(
Expand Down
2 changes: 2 additions & 0 deletions tests/pgpro2068.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def test_minrecpoint_on_replica(self):
"""
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 "
Expand Down
2 changes: 2 additions & 0 deletions tests/ptrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,8 @@ def test_ptrack_uncommitted_xact(self):
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'),
Expand Down
30 changes: 10 additions & 20 deletions tests/replica.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,11 +634,8 @@ def test_replica_promote(self):
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(
Expand Down Expand Up @@ -722,11 +719,8 @@ def test_replica_stop_lsn_null_offset(self):
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(
Expand Down Expand Up @@ -828,6 +822,8 @@ def test_replica_stop_lsn_null_offset_next_record(self):
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(
Expand Down Expand Up @@ -998,11 +994,8 @@ def test_replica_toast(self):
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(
Expand Down Expand Up @@ -1104,11 +1097,8 @@ def test_replica_toast(self):
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(
Expand Down