BIND 10 trac213-incremental-config, updated. 0f7a43ef24e2fedfa554200cbfa3d83971dbfd90 [213] Reimplement the start_* tests
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Nov 9 11:32:17 UTC 2011
The branch, trac213-incremental-config has been updated
via 0f7a43ef24e2fedfa554200cbfa3d83971dbfd90 (commit)
via 9f854755d1bad72bc4bd94accbc60d211c880cb7 (commit)
from 5c16ff47ae8d485da0684ee7dd5547eeef3c6232 (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 0f7a43ef24e2fedfa554200cbfa3d83971dbfd90
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Nov 9 12:31:40 2011 +0100
[213] Reimplement the start_* tests
Which check it is started correctly on startup, not only on
reconfiguration.
commit 9f854755d1bad72bc4bd94accbc60d211c880cb7
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Nov 9 11:29:14 2011 +0100
[213] Cleanups
-----------------------------------------------------------------------
Summary of changes:
src/bin/bind10/bind10_src.py.in | 11 ++++++---
src/bin/bind10/tests/bind10_test.py.in | 37 ++++++++++++++++++++++++++++++-
2 files changed, 42 insertions(+), 6 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in
index a5e75a0..0f75470 100755
--- a/src/bin/bind10/bind10_src.py.in
+++ b/src/bin/bind10/bind10_src.py.in
@@ -392,11 +392,15 @@ class BoB:
self.processes[pid].kill(True)
self.processes = {}
- def read_bind10_config(self):
+ def _read_bind10_config(self):
"""
Reads the parameters associated with the BoB module itself.
This means the list of components we should start now.
+
+ This could easily be combined into start_all_processes, but
+ it stays because of historical reasons and because the tests
+ replace the method sometimes.
"""
logger.info(BIND10_READING_BOSS_CONFIGURATION)
@@ -673,13 +677,12 @@ class BoB:
# Connect to the msgq. This is not a process, so it's not handled
# inside the configurator.
- c_channel_env = self.c_channel_env
- self.start_ccsession(c_channel_env)
+ self.start_ccsession(self.c_channel_env)
# Extract the parameters associated with Bob. This can only be
# done after the CC Session is started. Note that the logging
# configuration may override the "-v" switch set on the command line.
- self.read_bind10_config()
+ self._read_bind10_config()
# TODO: Return the dropping of privileges
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index 45367b5..11bdee7 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -244,7 +244,7 @@ class MockBob(BoB):
def stop_creator(self, kill=False):
self.creator = False
- def read_bind10_config(self):
+ def _read_bind10_config(self):
# Configuration options are set directly
pass
@@ -487,6 +487,39 @@ class TestStartStopProcessesBob(unittest.TestCase):
'special': 'resolver' }
return {'components': config}
+ def config_start_init(self, start_auth, start_resolver):
+ """
+ Test the configuration is loaded at the startup.
+ """
+ bob = MockBob()
+ config = self.construct_config(start_auth, start_resolver)
+ class CC:
+ def get_full_config(self):
+ return config
+ # Provide the fake CC with data
+ bob.ccs = CC()
+ # And make sure it's not overwritten
+ def start_ccsession():
+ bob.ccsession = True
+ bob.start_ccsession = lambda _: start_ccsession()
+ # We need to return the original _read_bind10_config
+ bob._read_bind10_config = lambda: BoB._read_bind10_config(bob)
+ bob.start_all_processes()
+ self.check_started(bob, True, start_auth, start_resolver)
+ self.check_environment_unchanged()
+
+ def test_start_none(self):
+ self.config_start_init(False, False)
+
+ def test_start_resolver(self):
+ self.config_start_init(False, True)
+
+ def test_start_auth(self):
+ self.config_start_init(True, False)
+
+ def test_start_both(self):
+ self.config_start_init(True, True)
+
def test_config_start(self):
"""
Test that the configuration starts and stops processes according
@@ -945,7 +978,7 @@ class TestBossComponents(unittest.TestCase):
# Start it
bob._component_configurator.reconfigure = self.__unary_hook
# We need to return the original read_bind10_config
- bob.read_bind10_config = lambda: BoB.read_bind10_config(bob)
+ bob._read_bind10_config = lambda: BoB._read_bind10_config(bob)
# And provide a session to read the data from
class CC:
pass
More information about the bind10-changes
mailing list