mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Implement unit test for reap_children function
This commit is contained in:
+4
-3
@@ -2,7 +2,7 @@ import os
|
|||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from helpers.utils import sigchld_handler, sigterm_handler, sleep
|
from helpers.utils import reap_children, sigchld_handler, sigterm_handler, sleep
|
||||||
|
|
||||||
|
|
||||||
def nop(*args, **kwargs):
|
def nop(*args, **kwargs):
|
||||||
@@ -34,10 +34,11 @@ class TestUtils(unittest.TestCase):
|
|||||||
def test_sigterm_handler(self):
|
def test_sigterm_handler(self):
|
||||||
self.assertRaises(SystemExit, sigterm_handler, None, None)
|
self.assertRaises(SystemExit, sigterm_handler, None, None)
|
||||||
|
|
||||||
def test_sigchld_handler(self):
|
def test_reap_children(self):
|
||||||
sigchld_handler(None, None)
|
reap_children()
|
||||||
os.waitpid = os_waitpid
|
os.waitpid = os_waitpid
|
||||||
sigchld_handler(None, None)
|
sigchld_handler(None, None)
|
||||||
|
reap_children()
|
||||||
|
|
||||||
def test_sleep(self):
|
def test_sleep(self):
|
||||||
time.sleep = time_sleep
|
time.sleep = time_sleep
|
||||||
|
|||||||
Reference in New Issue
Block a user