Skip to content

Commit 26939d6

Browse files
author
Ivan Lazarev
committed
[PBCKP-220] removed inheritance GDBObj->ProbackupTest
1 parent 32aae17 commit 26939d6

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

tests/helpers/ptrack_helpers.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -810,8 +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
814-
return GDBobj([binary_path] + command, self.verbose)
813+
return GDBobj([binary_path] + command, self)
815814
if asynchronous:
816815
return subprocess.Popen(
817816
[binary_path] + command,
@@ -1862,8 +1861,7 @@ def compare_pgdata(self, original_pgdata, restored_pgdata, exclusion_dict = dict
18621861
self.assertFalse(fail, error_message)
18631862

18641863
def gdb_attach(self, pid):
1865-
#TODO REVIEW XXX no self parameter
1866-
return GDBobj([str(pid)], self.verbose, attach=True)
1864+
return GDBobj([str(pid)], self, attach=True)
18671865

18681866
def _check_gdb_flag_or_skip_test(self):
18691867
if not self.gdb:
@@ -1872,24 +1870,28 @@ def _check_gdb_flag_or_skip_test(self):
18721870
"optimizations for run this test"
18731871
)
18741872

1873+
18751874
class GdbException(Exception):
1876-
def __init__(self, message=False):
1875+
def __init__(self, message="False"):
18771876
self.message = message
18781877

18791878
def __str__(self):
18801879
return '\n ERROR: {0}\n'.format(repr(self.message))
18811880

18821881

1883-
class GDBobj(ProbackupTest):
1884-
def __init__(self, cmd, verbose, attach=False):
1885-
self.verbose = verbose
1882+
#TODO REVIEW XXX no inheritance needed
1883+
# class GDBobj(ProbackupTest):
1884+
class GDBobj:
1885+
# TODO REVIEW XXX Type specification env:ProbackupTest is only for python3, is it ok?
1886+
def __init__(self, cmd, env: ProbackupTest, attach=False):
1887+
self.verbose = env.verbose
18861888
self.output = ''
18871889

18881890
# 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")
1891+
if not env.gdb:
1892+
raise GdbException("No `PGPROBACKUP_GDB=on` is set, "
1893+
"test should call ProbackupTest::check_gdb_flag_or_skip_test() on its start "
1894+
"and be skipped")
18931895
# Check gdb presense
18941896
try:
18951897
gdb_version, _ = subprocess.Popen(

tests/replica.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,6 @@ def test_replica_stop_lsn_null_offset(self):
719719
def test_replica_stop_lsn_null_offset_next_record(self):
720720
"""
721721
"""
722-
self._check_gdb_flag_or_skip_test()
723722

724723
fname = self.id().split('.')[3]
725724
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
@@ -743,7 +742,6 @@ def test_replica_stop_lsn_null_offset_next_record(self):
743742

744743
# freeze bgwriter to get rid of RUNNING XACTS records
745744
bgwriter_pid = master.auxiliary_pids[ProcessType.BackgroundWriter][0]
746-
gdb_checkpointer = self.gdb_attach(bgwriter_pid)
747745

748746
self.backup_node(backup_dir, 'master', master)
749747

@@ -1097,7 +1095,6 @@ def test_replica_toast(self):
10971095
def test_start_stop_lsn_in_the_same_segno(self):
10981096
"""
10991097
"""
1100-
self._check_gdb_flag_or_skip_test()
11011098

11021099
fname = self.id().split('.')[3]
11031100
backup_dir = os.path.join(self.tmp_path, module_name, fname, 'backup')
@@ -1121,7 +1118,6 @@ def test_start_stop_lsn_in_the_same_segno(self):
11211118

11221119
# freeze bgwriter to get rid of RUNNING XACTS records
11231120
bgwriter_pid = master.auxiliary_pids[ProcessType.BackgroundWriter][0]
1124-
gdb_checkpointer = self.gdb_attach(bgwriter_pid)
11251121

11261122
self.backup_node(backup_dir, 'master', master, options=['--stream'])
11271123

0 commit comments

Comments
 (0)