def test_nova_instance_delete_end(self): compute_model = self.fake_cdmc.generate_scenario_3_with_2_nodes() self.fake_cdmc.cluster_data_model = compute_model handler = novanotification.InstanceDeletedEnd(self.fake_cdmc) instance0_uuid = '73b09e16-35b7-4922-804e-e8f5d9b740fc' # Before self.assertTrue(compute_model.get_instance_by_uuid(instance0_uuid)) for resource in compute_model.resource.values(): self.assertIn(instance0_uuid, resource.mapping) message = self.load_message('scenario3_instance-delete-end.json') handler.info( ctxt=self.context, publisher_id=message['publisher_id'], event_type=message['event_type'], payload=message['payload'], metadata=self.FAKE_METADATA, ) # After self.assertRaises(exception.InstanceNotFound, compute_model.get_instance_by_uuid, instance0_uuid) for resource in compute_model.resource.values(): self.assertNotIn(instance0_uuid, resource.mapping)
def __init__(self): self.api_version = self.API_VERSION self.service_name = None # fake cluster instead on Nova CDM self.fake_cdmc = faker_cluster_state.FakerModelCollector() self.publisher_id = 'test_publisher_id' self.conductor_topic = 'test_conductor_topic' self.status_topic = 'test_status_topic' self.notification_topics = ['nova'] self.conductor_endpoints = [] # Disable audit endpoint self.status_endpoints = [] self.notification_endpoints = [ novanotification.ServiceUpdated(self.fake_cdmc), novanotification.InstanceCreated(self.fake_cdmc), novanotification.InstanceUpdated(self.fake_cdmc), novanotification.InstanceDeletedEnd(self.fake_cdmc), novanotification.LegacyInstanceCreatedEnd(self.fake_cdmc), novanotification.LegacyInstanceUpdated(self.fake_cdmc), novanotification.LegacyLiveMigratedEnd(self.fake_cdmc), novanotification.LegacyInstanceDeletedEnd(self.fake_cdmc), ]
def notification_endpoints(self): return [ novanotification.ServiceUpdated(self.fake_cdmc), novanotification.InstanceCreated(self.fake_cdmc), novanotification.InstanceUpdated(self.fake_cdmc), novanotification.InstanceDeletedEnd(self.fake_cdmc), novanotification.LegacyInstanceCreatedEnd(self.fake_cdmc), novanotification.LegacyInstanceUpdated(self.fake_cdmc), novanotification.LegacyLiveMigratedEnd(self.fake_cdmc), novanotification.LegacyInstanceDeletedEnd(self.fake_cdmc), ]
def notification_endpoints(self): """Associated notification endpoints :return: Associated notification endpoints :rtype: List of :py:class:`~.EventsNotificationEndpoint` instances """ return [ nova.ServiceUpdated(self), nova.InstanceCreated(self), nova.InstanceUpdated(self), nova.InstanceDeletedEnd(self), nova.LegacyInstanceCreatedEnd(self), nova.LegacyInstanceUpdated(self), nova.LegacyInstanceDeletedEnd(self), nova.LegacyLiveMigratedEnd(self), ]