BIND 10 trac213, updated. 49b9f8004299533dd7e54bde3820984d8b04f37b [213] Test for plans of adding and removing component
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Oct 10 10:41:15 UTC 2011
The branch, trac213 has been updated
via 49b9f8004299533dd7e54bde3820984d8b04f37b (commit)
from 8f6ca91d01a5155ace94f0c044e674e58f8e7898 (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 49b9f8004299533dd7e54bde3820984d8b04f37b
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon Oct 10 12:39:55 2011 +0200
[213] Test for plans of adding and removing component
-----------------------------------------------------------------------
Summary of changes:
src/lib/python/isc/bind10/tests/component_test.py | 34 +++++++++++++++++++--
1 files changed, 31 insertions(+), 3 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/bind10/tests/component_test.py b/src/lib/python/isc/bind10/tests/component_test.py
index e37146a..efe83a4 100644
--- a/src/lib/python/isc/bind10/tests/component_test.py
+++ b/src/lib/python/isc/bind10/tests/component_test.py
@@ -527,9 +527,8 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
def test_build_plan(self):
"""
- Test building the plan correctly. Currently, we let it only create
- the initial plan when the old configuration is empty, as we don't need
- more for the starts.
+ Test building the plan correctly. Not complete yet, this grows as we
+ add more ways of changing the plan.
"""
configurator = Configurator(self)
plan = configurator._build_plan({}, self.__core)
@@ -540,6 +539,35 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
self.assertTrue('component' in task)
self.assertEqual('start', task['command'])
self.assertEqual(name, task['name'])
+
+ # A plan to go from older state to newer one containing more components
+ bigger = copy.copy(self.__core)
+ bigger['additional'] = {
+ 'priority': 6,
+ 'special': 'test',
+ 'process': 'additional',
+ 'kind': 'needed'
+ }
+ self.log = []
+ plan = configurator._build_plan(self.__core, bigger)
+ self.assertEqual([('additional', 'init'), ('additional', 'needed')],
+ self.log)
+ self.assertEqual(1, len(plan))
+ self.assertTrue('component' in plan[0])
+ component = plan[0]['component']
+ self.assertEqual('start', plan[0]['command'])
+ self.assertEqual('additional', plan[0]['name'])
+
+ # Now remove the one component again
+ # We run the plan so the component is wired into internal structures
+ configurator._run_plan(plan)
+ self.log = []
+ plan = configurator._build_plan(bigger, self.__core)
+ self.assertEqual([], self.log)
+ self.assertEqual([{
+ 'command': 'stop',
+ 'component': component
+ }], plan)
# TODO: More scenarios for changes between configurations are needed
def test_startup(self):
More information about the bind10-changes
mailing list