mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-24 08:52:38 +02:00
[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
9924ab014
[PBCKP-304] extended testgres.PosgresNode to ...
since tests uses os.kill directly.
This commit is contained in:
parent
e674202eac
commit
73cce507c2
@ -972,7 +972,7 @@ class CatchupTest(ProbackupTest, unittest.TestCase):
|
||||
self.set_auto_conf(dst_pg, dst_options)
|
||||
dst_pg.slow_start()
|
||||
self.assertNotEqual(dst_pg.pid, 0, "Cannot detect pid of running postgres")
|
||||
os.kill(dst_pg.pid, signal.SIGKILL)
|
||||
dst_pg.kill()
|
||||
|
||||
# preparation 3: make changes on master (source)
|
||||
src_pg.pgbench_init(scale = 10)
|
||||
@ -1061,7 +1061,7 @@ class CatchupTest(ProbackupTest, unittest.TestCase):
|
||||
self.set_auto_conf(dst_pg, dst_options)
|
||||
dst_pg.slow_start()
|
||||
self.assertNotEqual(dst_pg.pid, 0, "Cannot detect pid of running postgres")
|
||||
os.kill(dst_pg.pid, signal.SIGKILL)
|
||||
dst_pg.kill()
|
||||
|
||||
# preparation 3: make changes on master (source)
|
||||
src_pg.pgbench_init(scale = 10)
|
||||
|
@ -3,6 +3,7 @@ import os
|
||||
import gc
|
||||
import unittest
|
||||
from sys import exit, argv, version_info
|
||||
import signal
|
||||
import subprocess
|
||||
import shutil
|
||||
import six
|
||||
@ -190,6 +191,14 @@ class PostgresNodeExtended(testgres.PostgresNode):
|
||||
self.is_started = False
|
||||
return result
|
||||
|
||||
def kill(self, someone = None):
|
||||
if self.is_started:
|
||||
sig = signal.SIGKILL if os.name != 'nt' else signal.SIGBREAK
|
||||
if someone == None:
|
||||
os.kill(self.pid, sig)
|
||||
else:
|
||||
os.kill(self.auxiliary_pids[someone][0], sig)
|
||||
self.is_started = False
|
||||
|
||||
class ProbackupTest(object):
|
||||
# Class attributes
|
||||
|
@ -85,7 +85,6 @@ class BugTest(ProbackupTest, unittest.TestCase):
|
||||
# get pids of replica background workers
|
||||
startup_pid = replica.auxiliary_pids[ProcessType.Startup][0]
|
||||
checkpointer_pid = replica.auxiliary_pids[ProcessType.Checkpointer][0]
|
||||
bgwriter_pid = replica.auxiliary_pids[ProcessType.BackgroundWriter][0]
|
||||
|
||||
# break checkpointer on UpdateLastRemovedPtr
|
||||
gdb_checkpointer = self.gdb_attach(checkpointer_pid)
|
||||
@ -108,7 +107,7 @@ class BugTest(ProbackupTest, unittest.TestCase):
|
||||
pgbench.stdout.close()
|
||||
|
||||
# kill someone, we need a crash
|
||||
os.kill(int(bgwriter_pid), 9)
|
||||
replica.kill(someone=ProcessType.BackgroundWriter)
|
||||
gdb_recovery._execute('detach')
|
||||
gdb_checkpointer._execute('detach')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user