本文整理汇总了Python中socorro.external.es.crashstorage.ESCrashStorage._index_crash方法的典型用法代码示例。如果您正苦于以下问题:Python ESCrashStorage._index_crash方法的具体用法?Python ESCrashStorage._index_crash怎么用?Python ESCrashStorage._index_crash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类socorro.external.es.crashstorage.ESCrashStorage
的用法示例。
在下文中一共展示了ESCrashStorage._index_crash方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_index_data_capture
# 需要导入模块: from socorro.external.es.crashstorage import ESCrashStorage [as 别名]
# 或者: from socorro.external.es.crashstorage.ESCrashStorage import _index_crash [as 别名]
def test_index_data_capture(self):
"""Verify we capture index data in ES crashstorage"""
with MetricsMock() as mm:
es_storage = ESCrashStorage(config=self.config, namespace='processor.es')
mock_connection = mock.Mock()
# Do a successful indexing
es_storage._index_crash(
connection=mock_connection,
es_index=None,
es_doctype=None,
crash_document=None,
crash_id=None
)
# Do a failed indexing
mock_connection.index.side_effect = Exception
with pytest.raises(Exception):
es_storage._index_crash(
connection=mock_connection,
es_index=None,
es_doctype=None,
crash_document=None,
crash_id=None
)
assert (
len(mm.filter_records(stat='processor.es.index', tags=['outcome:successful'])) == 1
)
assert (
len(mm.filter_records(stat='processor.es.index', tags=['outcome:failed'])) == 1
)