mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 21:45:37 +00:00
[2244] added a test case that reproduces one aspect of the problem.
the configurator should be able to delete a component to be removed even if the it's failing (unexpectedly). The current implementation doesn't handle that condition correctly.
This commit is contained in:
@@ -872,12 +872,13 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
|
|||||||
'priority': 6,
|
'priority': 6,
|
||||||
'special': 'test',
|
'special': 'test',
|
||||||
'process': 'additional',
|
'process': 'additional',
|
||||||
'kind': 'needed'
|
'kind': 'dispensable' # need to be dispensable so it could restart
|
||||||
}
|
}
|
||||||
self.log = []
|
self.log = []
|
||||||
plan = configurator._build_plan(self.__build_components(self.__core),
|
plan = configurator._build_plan(self.__build_components(self.__core),
|
||||||
bigger)
|
bigger)
|
||||||
self.assertEqual([('additional', 'init'), ('additional', 'needed')],
|
self.assertEqual([('additional', 'init'),
|
||||||
|
('additional', 'dispensable')],
|
||||||
self.log)
|
self.log)
|
||||||
self.assertEqual(1, len(plan))
|
self.assertEqual(1, len(plan))
|
||||||
self.assertTrue('component' in plan[0])
|
self.assertTrue('component' in plan[0])
|
||||||
@@ -888,15 +889,27 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
|
|||||||
# Now remove the one component again
|
# Now remove the one component again
|
||||||
# We run the plan so the component is wired into internal structures
|
# We run the plan so the component is wired into internal structures
|
||||||
configurator._run_plan(plan)
|
configurator._run_plan(plan)
|
||||||
self.log = []
|
# We should have the 'additional' component in the configurator.
|
||||||
plan = configurator._build_plan(self.__build_components(bigger),
|
self.assertTrue('additional' in configurator._components)
|
||||||
self.__core)
|
for count in [0, 1]: # repeat two times, see below
|
||||||
self.assertEqual([], self.log)
|
self.log = []
|
||||||
self.assertEqual([{
|
plan = configurator._build_plan(self.__build_components(bigger),
|
||||||
'command': 'stop',
|
self.__core)
|
||||||
'name': 'additional',
|
self.assertEqual([], self.log)
|
||||||
'component': component
|
self.assertEqual([{
|
||||||
}], plan)
|
'command': 'stop',
|
||||||
|
'name': 'additional',
|
||||||
|
'component': component
|
||||||
|
}], plan)
|
||||||
|
|
||||||
|
if count is 0:
|
||||||
|
# We then emulate unexpected failure of the component (but
|
||||||
|
# before it restarts). It shouldn't confuse the
|
||||||
|
# configurator in the second phase of the test
|
||||||
|
component.failed(0)
|
||||||
|
# Run the plan, confirm the specified component is gone.
|
||||||
|
configurator._run_plan(plan)
|
||||||
|
self.assertFalse('additional' in configurator._components)
|
||||||
|
|
||||||
# We want to switch a component. So, prepare the configurator so it
|
# We want to switch a component. So, prepare the configurator so it
|
||||||
# holds one
|
# holds one
|
||||||
|
Reference in New Issue
Block a user