Merge "Fix mark-down after the latest changes in vitrage-id"

This commit is contained in:
Jenkins 2017-05-22 16:06:01 +00:00 committed by Gerrit Code Review
commit ba4eb18ed2
3 changed files with 49 additions and 3 deletions

View File

@ -53,6 +53,7 @@ class MarkDown(base.Recipe):
update_vertex_params = {
VProps.VITRAGE_ID: target_id,
VProps.IS_REAL_VITRAGE_ID: True,
VProps.IS_MARKED_DOWN: is_marked_down
}
update_vertex_step = ActionStepWrapper(UPDATE_VERTEX,

View File

@ -46,7 +46,7 @@ class TestActionExecutor(TestFunctionalBase):
for datasource_name in cls.conf.datasources.types:
register_opts(cls.conf, datasource_name, cls.conf.datasources.path)
def test_execute_update_vertex(self):
def test_execute_set_state(self):
# Test Setup
processor = self._create_processor_with_graph(self.conf, uuid=True)
@ -94,6 +94,43 @@ class TestActionExecutor(TestFunctionalBase):
self.assertNotIn(
VProps.VITRAGE_STATE, host_vertex_after_undo.properties)
def test_execute_mark_down(self):
# Test Setup
processor = self._create_processor_with_graph(self.conf, uuid=True)
vertex_attrs = {VProps.TYPE: NOVA_HOST_DATASOURCE}
host_vertices = processor.entity_graph.get_vertices(
vertex_attr_filter=vertex_attrs)
host_vertex_before = host_vertices[0]
targets = {TFields.TARGET: host_vertex_before}
props = {}
action_spec = ActionSpecs(ActionType.MARK_DOWN, targets, props)
event_queue = queue.Queue()
action_executor = ActionExecutor(event_queue)
# Test Action - do
action_executor.execute(action_spec, ActionMode.DO)
processor.process_event(event_queue.get())
host_vertex_after = processor.entity_graph.get_vertex(
host_vertex_before.vertex_id)
# Test Assertions
self.assertTrue(host_vertex_after.get(VProps.IS_MARKED_DOWN))
# Test Action - undo
action_executor.execute(action_spec, ActionMode.UNDO)
processor.process_event(event_queue.get())
host_vertex_after_undo = processor.entity_graph.get_vertex(
host_vertex_before.vertex_id)
# Test Assertions
self.assertFalse(host_vertex_after_undo.get(VProps.IS_MARKED_DOWN))
def test_execute_add_edge(self):
# Test Setup

View File

@ -45,7 +45,7 @@ class MarkDownRecipeTest(base.BaseTest):
self.assertEqual(UPDATE_VERTEX, action_steps[0].type)
update_vertex_step_params = action_steps[0].params
self.assertEqual(2, len(update_vertex_step_params))
self.assertEqual(3, len(update_vertex_step_params))
is_marked_down = update_vertex_step_params[VProps.IS_MARKED_DOWN]
self.assertTrue(is_marked_down)
@ -53,6 +53,10 @@ class MarkDownRecipeTest(base.BaseTest):
vitrage_id = update_vertex_step_params[VProps.VITRAGE_ID]
self.assertEqual(self.target_vertex.vertex_id, vitrage_id)
is_real_vitrage_id = \
update_vertex_step_params[VProps.IS_REAL_VITRAGE_ID]
self.assertTrue(is_real_vitrage_id)
def test_get_undo_recipe(self):
# Test Action
@ -65,10 +69,14 @@ class MarkDownRecipeTest(base.BaseTest):
self.assertEqual(UPDATE_VERTEX, action_steps[0].type)
update_vertex_step_params = action_steps[0].params
self.assertEqual(2, len(update_vertex_step_params))
self.assertEqual(3, len(update_vertex_step_params))
is_marked_down = update_vertex_step_params[VProps.IS_MARKED_DOWN]
self.assertFalse(is_marked_down)
vitrage_id = update_vertex_step_params[VProps.VITRAGE_ID]
self.assertEqual(self.target_vertex.vertex_id, vitrage_id)
is_real_vitrage_id = \
update_vertex_step_params[VProps.IS_REAL_VITRAGE_ID]
self.assertTrue(is_real_vitrage_id)