def _verify_event_processing(self, event, count=1, owner=None): if not owner: owner = event['payload']['owner'] response, json_content = futils.search_request( self.base_url, MATCH_ALL, owner, "admin") json_content = futils.get_json(json_content) self.assertEqual(count, json_content['hits']['total']) return json_content
def test_searchlight_glance_metadefs_data(self): """Test that all the indexed metadefs data is served from api server""" self.metadefs_plugin.initial_indexing() self._flush_elasticsearch(self.metadefs_plugin.get_index_name()) metadefs_query = MATCH_ALL.copy() metadefs_query['index'] = self.metadefs_plugin.get_index_name() metadefs_query['type'] = self.metadefs_plugin.get_document_type() metadefs_query['sort'] = {'namespace': {'order': 'asc'}} response, json_content = futils.search_request(self.base_url, metadefs_query, self.metadefs_owner) self.assertEqual(self.metadefs_count, futils.get_json(json_content)['hits']['total'])
def test_es_all_data(self): """Test that all the data is indexed in elasticsearch server""" for plugin in self.images_plugin, self.metadefs_plugin: plugin.initial_indexing() self._flush_elasticsearch(self.images_plugin.get_index_name()) # Test the raw elasticsearch response es_url = "http://localhost:%s/_search" % ( self.api_server.elasticsearch_port) response, content = httplib2.Http().request(es_url) json_content = jsonutils.loads(content) self.assertEqual(self.all_doc_count, futils.get_json(json_content)['hits']['total'])
def test_searchlight_glance_images_data(self): """Test that all the indexed images data is served from api server""" self.images_plugin.initial_indexing() self._flush_elasticsearch(self.images_plugin.get_index_name()) glance_images_query = MATCH_ALL.copy() glance_images_query['index'] = self.images_plugin.get_index_name() glance_images_query['type'] = self.images_plugin.get_document_type() response, json_content = futils.search_request( self.base_url, glance_images_query, self.images_owner) self.assertEqual(self.images_count, futils.get_json(json_content)['hits']['total'])