def test_create_raw_data_should_populate_rawdata_and_rawdata_imagemeta(self): deployment = db.get_or_create_deployment('deployment1')[0] kwargs = { 'deployment': deployment, 'when': dt_to_decimal(datetime.utcnow()), 'tenant': '1', 'json': '{}', 'routing_key': 'monitor.info', 'state': 'verifying', 'old_state': 'pending', 'old_task': '', 'task': '', 'image_type': 1, 'publisher': '', 'event': 'compute.instance.exists', 'service': '', 'host': '', 'instance': '1234-5678-9012-3456', 'request_id': '1234', 'os_architecture': 'x86', 'os_version': '1', 'os_distro': 'windows', 'rax_options': '2'} rawdata = db.create_rawdata(**kwargs) for field in get_model_fields(RawData): if field.name != 'id': self.assertEquals(getattr(rawdata, field.name), kwargs[field.name]) raw_image_meta = RawDataImageMeta.objects.all()[0] self.assertEquals(raw_image_meta.raw, rawdata) self.assertEquals(raw_image_meta.os_architecture, kwargs['os_architecture']) self.assertEquals(raw_image_meta.os_version, kwargs['os_version']) self.assertEquals(raw_image_meta.os_distro, kwargs['os_distro']) self.assertEquals(raw_image_meta.rax_options, kwargs['rax_options'])
def _create_glance_rawdata(self): deployment = db.get_or_create_deployment('deployment1')[0] kwargs = { 'deployment': deployment, 'when': dt_to_decimal(datetime.utcnow()), 'owner': '1234567', 'json': '{}', 'routing_key': 'glance_monitor.info', 'image_type': 1, 'publisher': 'publisher', 'event': 'event', 'service': 'service', 'host': 'host', 'instance': '1234-5678-9012-3456', 'request_id': '1234', 'uuid': '1234-5678-0912-3456', 'status': 'active', } db.create_glance_rawdata(**kwargs) rawdata = GlanceRawData.objects.all()[0] return kwargs, rawdata
def test_create_raw_data_should_populate_rawdata_and_rawdata_imagemeta( self): deployment = db.get_or_create_deployment('deployment1')[0] kwargs = { 'deployment': deployment, 'when': dt_to_decimal(datetime.utcnow()), 'tenant': '1', 'json': '{}', 'routing_key': 'monitor.info', 'state': 'verifying', 'old_state': 'pending', 'old_task': 'building', 'task': 'saving', 'image_type': 1, 'publisher': 'publisher', 'event': 'compute.instance.exists', 'service': 'compute', 'host': 'host', 'instance': '1234-5678-9012-3456', 'request_id': '1234', 'os_architecture': 'x86', 'os_version': '1', 'os_distro': 'windows', 'rax_options': '2' } rawdata = db.create_nova_rawdata(**kwargs) for field in get_model_fields(RawData): if field.name != 'id': self.assertEquals(getattr(rawdata, field.name), kwargs[field.name]) raw_image_meta = RawDataImageMeta.objects.filter(raw_id=rawdata.id)[0] self.assertEquals(raw_image_meta.os_architecture, kwargs['os_architecture']) self.assertEquals(raw_image_meta.os_version, kwargs['os_version']) self.assertEquals(raw_image_meta.os_distro, kwargs['os_distro']) self.assertEquals(raw_image_meta.rax_options, kwargs['rax_options'])
def test_create_generic_rawdata_should_populate_generic_rawdata(self): deployment = db.get_or_create_deployment('deployment1')[0] kwargs = { 'deployment': deployment, 'when': dt_to_decimal(datetime.utcnow()), 'tenant': '1234567', 'json': '{}', 'routing_key': 'monitor.info', 'publisher': 'publisher', 'event': 'event', 'service': 'service', 'host': 'host', 'instance': '1234-5678-9012-3456', 'request_id': '1234', 'message_id': 'message_id'} db.create_generic_rawdata(**kwargs) rawdata = GenericRawData.objects.all()[0] for field in get_model_fields(GenericRawData): if field.name != 'id': self.assertEquals(getattr(rawdata, field.name), kwargs[field.name])
def test_create_generic_rawdata_should_populate_generic_rawdata(self): deployment = db.get_or_create_deployment('deployment1')[0] kwargs = { 'deployment': deployment, 'when': dt_to_decimal(datetime.utcnow()), 'tenant': '1234567', 'json': '{}', 'routing_key': 'monitor.info', 'publisher': 'publisher', 'event': 'event', 'service': 'service', 'host': 'host', 'instance': '1234-5678-9012-3456', 'request_id': '1234', 'message_id': 'message_id' } db.create_generic_rawdata(**kwargs) rawdata = GenericRawData.objects.all()[0] for field in get_model_fields(GenericRawData): if field.name != 'id': self.assertEquals(getattr(rawdata, field.name), kwargs[field.name])
self.assertEquals(getattr(rawdata, field.name), kwargs[field.name]) class NovaRawDataSearchTestCase(TransactionTestCase): def test_search_results_for_nova(self): expected_result = [[ '#', '?', 'When', 'Deployment', 'Event', 'Host', 'State', "State'", "Task'" ], [ 1L, ' ', '2013-07-17 10:16:10.717219', 'depl', 'event', 'host', 'state', 'old_state', 'old_task' ]] depl = db.get_or_create_deployment('depl')[0] when = dt.dt_to_decimal(datetime.utcnow()) raw = db.create_nova_rawdata(deployment=depl, routing_key='routing_key', tenant='tenant', json='json', when=when, publisher='publisher', event='event', service='nova', host='host', instance='instance', request_id='req-1234', state='state', old_state='old_state', task='task',
db.create_generic_rawdata(**kwargs) rawdata = GenericRawData.objects.all()[0] for field in get_model_fields(GenericRawData): if field.name != 'id': self.assertEquals(getattr(rawdata, field.name), kwargs[field.name]) class NovaRawDataSearchTestCase(TransactionTestCase): def test_search_results_for_nova(self): expected_result = [['#', '?', 'When', 'Deployment', 'Event', 'Host', 'State', "State'", "Task'"], [1L, ' ', '2013-07-17 10:16:10.717219', 'depl', 'event', 'host', 'state', 'old_state', 'old_task']] depl = db.get_or_create_deployment('depl')[0] when = dt.dt_to_decimal(datetime.utcnow()) raw = db.create_nova_rawdata(deployment=depl, routing_key='routing_key', tenant='tenant', json='json', when=when, publisher='publisher', event='event', service='nova', host='host', instance='instance', request_id='req-1234', state='state', old_state='old_state', task='task',