mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-03 07:25:18 +00:00
[2244] added a simple has_component() method to configurtor.
should be pretty trivial, so added a couple of test cases as part of other tests.
This commit is contained in:
@@ -571,6 +571,10 @@ class Configurator:
|
|||||||
self._running = False
|
self._running = False
|
||||||
self.__reconfigure_internal(self._components, {})
|
self.__reconfigure_internal(self._components, {})
|
||||||
|
|
||||||
|
def has_component(self, component):
|
||||||
|
'''Return if a specified component is configured.'''
|
||||||
|
return component in map(lambda x: x[1], self._components.values())
|
||||||
|
|
||||||
def reconfigure(self, configuration):
|
def reconfigure(self, configuration):
|
||||||
"""
|
"""
|
||||||
Changes configuration from the current one to the provided. It
|
Changes configuration from the current one to the provided. It
|
||||||
|
@@ -896,7 +896,7 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
|
|||||||
# 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)
|
||||||
# We should have the 'additional' component in the configurator.
|
# We should have the 'additional' component in the configurator.
|
||||||
self.assertTrue('additional' in configurator._components)
|
self.assertTrue(configurator.has_component(component))
|
||||||
for count in [0, 1]: # repeat two times, see below
|
for count in [0, 1]: # repeat two times, see below
|
||||||
self.log = []
|
self.log = []
|
||||||
plan = configurator._build_plan(self.__build_components(bigger),
|
plan = configurator._build_plan(self.__build_components(bigger),
|
||||||
@@ -915,6 +915,8 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
|
|||||||
component.failed(0)
|
component.failed(0)
|
||||||
# Run the plan, confirm the specified component is gone.
|
# Run the plan, confirm the specified component is gone.
|
||||||
configurator._run_plan(plan)
|
configurator._run_plan(plan)
|
||||||
|
self.assertFalse(configurator.has_component(component))
|
||||||
|
# There shouldn't be any other object that has the same name
|
||||||
self.assertFalse('additional' in configurator._components)
|
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
|
||||||
|
Reference in New Issue
Block a user