8000 [PBCKP-358] fix CatchupTest.test_unclean_(delta|ptrack)_catchup · postgrespro/pg_probackup@73cce50 · GitHub
[go: up one dir, main page]

Skip to content

Commit 73cce50

Browse files
committed
[PBCKP-358] fix CatchupTest.test_unclean_(delta|ptrack)_catchup
and BugTest.test_minrecpoint_on_replica as well Tests were broken with introduction of "startness" handling in 9924ab0 [PBCKP-304] extended testgres.PosgresNode to ... since tests uses os.kill directly.
1 parent e674202 commit 73cce50

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

tests/catchup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ def test_unclean_delta_catchup(self):
972972
self.set_auto_conf(dst_pg, dst_options)
973973
dst_pg.slow_start()
974974
self.assertNotEqual(dst_pg.pid, 0, "Cannot detect pid of running postgres")
975-
os.kill(dst_pg.pid, signal.SIGKILL)
975+
dst_pg.kill()
976976

977977
# preparation 3: make changes on master (source)
978978
src_pg.pgbench_init(scale = 10)
@@ -1061,7 +1061,7 @@ def test_unclean_ptrack_catchup(self):
10611061
self.set_auto_conf(dst_pg, dst_options)
10621062
dst_pg.slow_start()
10631063
self.assertNotEqual(dst_pg.pid, 0, "Cannot detect pid of running postgres")
1064-
os.kill(dst_pg.pid, signal.SIGKILL)
1064+
dst_pg.kill()
10651065

10661066
# preparation 3: make changes on master (source)
10671067
src_pg.pgbench_init(scale = 10)

tests/helpers/ptrack_helpers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import gc
44
import unittest
55
from sys import exit, argv, version_info
6+
import signal
67
import subprocess
78
import shutil
89
import six
@@ -190,6 +191,14 @@ def stop(self, *args, **kwargs):
190191
self.is_started = False
191192
return result
192193

194+
def kill(self, someone = None):
195+
if self.is_started:
196+
sig = signal.SIGKILL if os.name != 'nt' else signal.SIGBREAK
197+
if someone == None:
198+
os.kill(self.pid, sig)
199+
else:
200+
os.kill(self.auxiliary_pids[someone][0], sig)
201+
self.is_started = False
193202

194203
class ProbackupTest(object):
195204
# Class attributes

tests/pgpro2068.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def test_minrecpoint_on_replica(self):
8585
# get pids of replica background workers
8686
startup_pid = replica.auxiliary_pids[ProcessType.Startup][0]
8787
checkpointer_pid = replica.auxiliary_pids[ProcessType.Checkpointer][0]
88-
bgwriter_pid = replica.auxiliary_pids[ProcessType.BackgroundWriter][0]
8988

9089
# break checkpointer on UpdateLastRemovedPtr
9190
gdb_checkpointer = self.gdb_attach(checkpointer_pid)
@@ -108,7 +107,7 @@ def test_minrecpoint_on_replica(self):
108107
pgbench.stdout.close()
109108

110109
# kill someone, we need a crash
111-
os.kill(int(bgwriter_pid), 9)
110+
replica.kill(someone=ProcessType.BackgroundWriter)
112111
gdb_recovery._execute('detach')
113112
gdb_checkpointer._execute('detach')
114113

0 commit comments

Comments
 (0)
0