Beispiel #1
0
 def get_ceph_results_per_type(cls, store: ResultStorageBase) -> None:
     """Get the total number of results in Ceph per service."""
     _LOGGER.info("Check Ceph content for %s", store.RESULT_TYPE)
     if not store.is_connected():
         store.connect()
     number_ids = store.get_document_count()
     metrics.ceph_results_number.labels(store.RESULT_TYPE).set(number_ids)
     _LOGGER.debug("ceph_results_number for %s =%d", store.RESULT_TYPE,
                   number_ids)
Beispiel #2
0
 def test_assertion_error(self):
     """Test assertion error if a developer does not provide RESULT_TYPE."""
     with pytest.raises(AssertionError):
         ResultStorageBase(deployment_name=_DEPLOYMENT_NAME,
                           prefix=_BUCKET_PREFIX,
                           **CEPH_INIT_KWARGS)
Beispiel #3
0
 def test_get_document_id(self):
     # Make sure we pick document id from right place.
     document = {'metadata': {'hostname': 'localhost'}}
     assert ResultStorageBase.get_document_id(document) == 'localhost'
Beispiel #4
0
 def test_get_document_id(self):
     # Make sure we pick document id from right place.
     document = {"metadata": {"document_id": "foo"}}
     assert ResultStorageBase.get_document_id(document) == "foo"
 def test_get_document_id(self):
     # Make sure we pick document id from right place.
     document = {'metadata': {'document_id': 'foo'}}
     assert ResultStorageBase.get_document_id(document) == 'foo'