BIND 10 trac1819, updated. 37a7ed4209e5823abcea248cd9431a4df1c79bfc bug #1819: Remove duplicated code
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Mar 27 08:20:50 UTC 2012
The branch, trac1819 has been updated
via 37a7ed4209e5823abcea248cd9431a4df1c79bfc (commit)
from 8e75f294beadf32c9d7cdb0de879c4c5180ab9f5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 37a7ed4209e5823abcea248cd9431a4df1c79bfc
Author: Mukund Sivaraman <muks at isc.org>
Date: Tue Mar 27 13:50:39 2012 +0530
bug #1819: Remove duplicated code
-----------------------------------------------------------------------
Summary of changes:
src/bin/bind10/tests/bind10_test.py.in | 59 ++++++++-----------------------
1 files changed, 15 insertions(+), 44 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index fa01d11..01577c8 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -1170,11 +1170,13 @@ class TestBossComponents(unittest.TestCase):
# We check somewhere else that the shutdown is actually called
# from there (the test_kills).
- def test_kills(self):
+ def __real_test_kill(self, nokill = False):
"""
- Test that the boss kills components which don't want to stop.
+ Helper function that does the actual kill functionality testing.
"""
bob = MockBob()
+ bob.nokill = nokill
+
killed = []
class ImmortalComponent:
"""
@@ -1208,59 +1210,28 @@ class TestBossComponents(unittest.TestCase):
# Here, killed is an array where False is added if SIGTERM
# should be sent, or True if SIGKILL should be sent, in order in
# which they're sent.
- self.assertEqual([False, True], killed)
+ if nokill:
+ self.assertEqual([], killed)
+ else:
+ self.assertEqual([False, True], killed)
self.assertTrue(self.__called)
bob._component_configurator.shutdown = orig
+ def test_kills(self):
+ """
+ Test that the boss kills components which don't want to stop.
+ """
+ self.__real_test_kill()
+
def test_nokill(self):
"""
Test that the boss *doesn't* kill components which don't want to
stop, when asked not to (by passing the --no-kill option which
sets bob.nokill to True).
"""
- bob = MockBob()
- bob.nokill = True
-
- killed = []
- class ImmortalComponent:
- """
- An immortal component. It does not stop when it is told so
- (anyway it is not told so). It does not die if it is killed
- the first time. It dies only when killed forcefully.
- """
- def kill(self, forceful=False):
- killed.append(forceful)
- if forceful:
- bob.components = {}
- def pid(self):
- return 1
- def name(self):
- return "Immortal"
- bob.components = {}
- bob.register_process(1, ImmortalComponent())
-
- # While at it, we check the configurator shutdown is actually called
- orig = bob._component_configurator.shutdown
- bob._component_configurator.shutdown = self.__nullary_hook
- self.__called = False
-
- bob.ccs = MockModuleCCSession()
- self.assertFalse(bob.ccs.stopped)
-
- bob.shutdown()
-
- self.assertTrue(bob.ccs.stopped)
-
- # Here, killed is an array where False is added if SIGTERM
- # should be sent, or True if SIGKILL should be sent, in order in
- # which they're sent.
- self.assertEqual([], killed)
-
- self.assertTrue(self.__called)
-
- bob._component_configurator.shutdown = orig
+ self.__real_test_kill(True)
def test_component_shutdown(self):
"""
More information about the bind10-changes
mailing list