本文整理汇总了Python中socorro.processor.legacy_processor.LegacyCrashProcessor._create_basic_processed_crash方法的典型用法代码示例。如果您正苦于以下问题:Python LegacyCrashProcessor._create_basic_processed_crash方法的具体用法?Python LegacyCrashProcessor._create_basic_processed_crash怎么用?Python LegacyCrashProcessor._create_basic_processed_crash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类socorro.processor.legacy_processor.LegacyCrashProcessor
的用法示例。
在下文中一共展示了LegacyCrashProcessor._create_basic_processed_crash方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_convert_raw_crash_to_processed_crash_unexpected_error
# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _create_basic_processed_crash [as 别名]
def test_convert_raw_crash_to_processed_crash_unexpected_error(self):
config = setup_config_with_mocks()
mocked_transform_rules_str = "socorro.processor.legacy_processor.TransformRuleSystem"
with mock.patch(mocked_transform_rules_str) as m_transform_class:
m_transform = mock.Mock()
m_transform_class.return_value = m_transform
m_transform.attach_mock(mock.Mock(), "apply_all_rules")
utc_now_str = "socorro.processor.legacy_processor.utc_now"
with mock.patch(utc_now_str) as m_utc_now:
m_utc_now.return_value = datetime(2012, 5, 4, 15, 11, tzinfo=UTC)
raw_crash = DotDict()
raw_crash.uuid = "3bc4bcaa-b61d-4d1f-85ae-30cb32120504"
raw_crash.submitted_timestamp = "2012-05-04T15:33:33"
raw_dump = {"upload_file_minidump": "abcdef"}
leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)
started_timestamp = datetime(2012, 5, 4, 15, 10, tzinfo=UTC)
leg_proc._log_job_start = mock.Mock(return_value=started_timestamp)
basic_processed_crash = DotDict()
basic_processed_crash.uuid = raw_crash.uuid
basic_processed_crash.success = False
basic_processed_crash.hang_type = 0
basic_processed_crash.java_stack_trace = None
leg_proc._create_basic_processed_crash = mock.Mock(return_value=basic_processed_crash)
leg_proc._get_temp_dump_pathname = mock.Mock(return_value="/tmp/x")
leg_proc._log_job_end = mock.Mock()
processed_crash_update_dict = DotDict()
processed_crash_update_dict.success = True
leg_proc._do_breakpad_stack_dump_analysis = mock.Mock(
side_effect=Exception("nobody expects the spanish " "inquisition")
)
# Here's the call being tested
processed_crash = leg_proc.convert_raw_crash_to_processed_crash(raw_crash, raw_dump)
self.assertEqual(1, leg_proc._log_job_end.call_count)
leg_proc._log_job_end.assert_called_with(
datetime(2012, 5, 4, 15, 11, tzinfo=UTC), False, raw_crash.uuid
)
e = {
"processor_notes": "testing_processor:2012; unrecoverable " "processor error",
"completeddatetime": datetime(2012, 5, 4, 15, 11, tzinfo=UTC),
"success": False,
"uuid": raw_crash.uuid,
"hang_type": 0,
"java_stack_trace": None,
"additional_minidumps": [],
}
self.assertEqual(e, processed_crash)
leg_proc._statistics.assert_has_calls(
[mock.call.incr("jobs"), mock.call.incr("restarts"), mock.call.incr("errors")], any_order=True
)
示例2: test_create_basic_processed_crash_normal
# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _create_basic_processed_crash [as 别名]
def test_create_basic_processed_crash_normal(self):
config = setup_config_with_mocks()
config.collect_addon = False
config.collect_crash_process = False
mocked_transform_rules_str = \
'socorro.processor.legacy_processor.TransformRuleSystem'
with mock.patch(mocked_transform_rules_str) as m_transform_class:
m_transform = mock.Mock()
m_transform_class.return_value = m_transform
m_transform.attach_mock(mock.Mock(), 'apply_all_rules')
utc_now_str = 'socorro.processor.legacy_processor.utc_now'
with mock.patch(utc_now_str) as m_utc_now:
m_utc_now.return_value = datetime(2012, 5, 4, 15, 11,
tzinfo=UTC)
started_timestamp = datetime(2012, 5, 4, 15, 10, tzinfo=UTC)
raw_crash = canonical_standard_raw_crash
leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)
processor_notes = []
# test 01
processed_crash = leg_proc._create_basic_processed_crash(
'3bc4bcaa-b61d-4d1f-85ae-30cb32120504',
raw_crash,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
assert 'exploitability' in processed_crash
eq_(
processed_crash,
dict(cannonical_basic_processed_crash)
)
# test 02
processor_notes = []
raw_crash_missing_product = copy.deepcopy(raw_crash)
del raw_crash_missing_product['ProductName']
processed_crash = leg_proc._create_basic_processed_crash(
'3bc4bcaa-b61d-4d1f-85ae-30cb32120504',
raw_crash_missing_product,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
processed_crash_missing_product = \
copy.copy(cannonical_basic_processed_crash)
processed_crash_missing_product.product = None
eq_(
processed_crash,
processed_crash_missing_product
)
ok_('WARNING: raw_crash missing ProductName' in
processor_notes)
eq_(len(processor_notes), 1)
# test 03
processor_notes = []
raw_crash_missing_version = copy.deepcopy(raw_crash)
del raw_crash_missing_version['Version']
processed_crash = leg_proc._create_basic_processed_crash(
'3bc4bcaa-b61d-4d1f-85ae-30cb32120504',
raw_crash_missing_version,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
processed_crash_missing_version = \
copy.copy(cannonical_basic_processed_crash)
processed_crash_missing_version.version = None
eq_(
processed_crash,
processed_crash_missing_version
)
ok_('WARNING: raw_crash missing Version' in
processor_notes)
eq_(len(processor_notes), 1)
# test 04
processor_notes = []
raw_crash_with_hangid = copy.deepcopy(raw_crash)
raw_crash_with_hangid.HangID = \
'30cb3212-b61d-4d1f-85ae-3bc4bcaa0504'
processed_crash = leg_proc._create_basic_processed_crash(
'3bc4bcaa-b61d-4d1f-85ae-30cb32120504',
raw_crash_with_hangid,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
processed_crash_with_hangid = \
copy.copy(cannonical_basic_processed_crash)
processed_crash_with_hangid.hangid = \
raw_crash_with_hangid.HangID
processed_crash_with_hangid.hang_type = -1
eq_(
processed_crash,
processed_crash_with_hangid
)
#.........这里部分代码省略.........
示例3: test_process_crash_unexpected_error
# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _create_basic_processed_crash [as 别名]
def test_process_crash_unexpected_error(self):
config = setup_config_with_mocks()
mocked_transform_rules_str = \
'socorro.processor.legacy_processor.TransformRuleSystem'
with mock.patch(mocked_transform_rules_str) as m_transform_class:
m_transform = mock.Mock()
m_transform_class.return_value = m_transform
m_transform.attach_mock(mock.Mock(), 'apply_all_rules')
utc_now_str = 'socorro.processor.legacy_processor.utc_now'
with mock.patch(utc_now_str) as m_utc_now:
m_utc_now.return_value = datetime(2012, 5, 4, 15, 11,
tzinfo=UTC)
raw_crash = DotDict()
raw_crash.uuid = '3bc4bcaa-b61d-4d1f-85ae-30cb32120504'
raw_crash.submitted_timestamp = '2012-05-04T15:33:33'
raw_dump = {'upload_file_minidump': 'abcdef'}
leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)
started_timestamp = datetime(2012, 5, 4, 15, 10, tzinfo=UTC)
leg_proc._log_job_start = mock.Mock(
return_value=started_timestamp
)
basic_processed_crash = DotDict()
basic_processed_crash.uuid = raw_crash.uuid
basic_processed_crash.success = False
basic_processed_crash.hang_type = 0
basic_processed_crash.java_stack_trace = None
leg_proc._create_basic_processed_crash = mock.Mock(
return_value=basic_processed_crash)
leg_proc._get_temp_dump_pathname = mock.Mock(
return_value='/tmp/x'
)
leg_proc._log_job_end = mock.Mock()
processed_crash_update_dict = DotDict()
processed_crash_update_dict.success = True
leg_proc._do_breakpad_stack_dump_analysis = mock.Mock(
side_effect=Exception('nobody expects the spanish '
'inquisition')
)
# Here's the call being tested
processed_crash = \
leg_proc.process_crash(
raw_crash,
raw_dump,
{}
)
eq_(1, leg_proc._log_job_end.call_count)
leg_proc._log_job_end.assert_called_with(
datetime(2012, 5, 4, 15, 11, tzinfo=UTC),
False,
raw_crash.uuid
)
e = {
'processor_notes':
'testing_processor:2012; LegacyCrashProcessor; '
'unrecoverable processor error: '
'nobody expects the spanish inquisition',
'completeddatetime': datetime(2012, 5, 4, 15, 11,
tzinfo=UTC),
'success': False,
'uuid': raw_crash.uuid,
'hang_type': 0,
'java_stack_trace': None,
'additional_minidumps': [],
}
eq_(e, processed_crash)
leg_proc._statistics.assert_has_calls(
[
mock.call.incr('jobs'),
mock.call.incr('restarts'),
mock.call.incr('errors'),
],
any_order=True
)
示例4: test_process_crash_basic
# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _create_basic_processed_crash [as 别名]
def test_process_crash_basic(self):
config = setup_config_with_mocks()
mocked_transform_rules_str = \
'socorro.processor.legacy_processor.TransformRuleSystem'
with mock.patch(mocked_transform_rules_str) as m_transform_class:
m_transform = mock.Mock()
m_transform_class.return_value = m_transform
m_transform.attach_mock(mock.Mock(), 'apply_all_rules')
utc_now_str = 'socorro.processor.legacy_processor.utc_now'
with mock.patch(utc_now_str) as m_utc_now:
m_utc_now.return_value = datetime(2012, 5, 4, 15, 11,
tzinfo=UTC)
raw_crash = DotDict()
raw_crash.uuid = '3bc4bcaa-b61d-4d1f-85ae-30cb32120504'
raw_crash.submitted_timestamp = '2012-05-04T15:33:33'
raw_dump = {'upload_file_minidump':
'/some/path/%s.dump' % raw_crash.uuid,
'aux_dump_001':
'/some/path/aux_001.%s.dump' % raw_crash.uuid,
}
leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)
started_timestamp = datetime(2012, 5, 4, 15, 10, tzinfo=UTC)
leg_proc._log_job_start = mock.Mock(
return_value=started_timestamp
)
basic_processed_crash = DotDict()
basic_processed_crash.uuid = raw_crash.uuid
basic_processed_crash.hang_type = 0
basic_processed_crash.java_stack_trace = None
leg_proc._create_basic_processed_crash = mock.Mock(
return_value=basic_processed_crash)
leg_proc._log_job_end = mock.Mock()
processed_crash_update_dict = DotDict()
processed_crash_update_dict.success = True
leg_proc._do_breakpad_stack_dump_analysis = mock.Mock(
return_value=processed_crash_update_dict
)
leg_proc._cleanup_temp_file = mock.Mock()
# Here's the call being tested
processed_crash = \
leg_proc.process_crash(
raw_crash,
raw_dump,
{}
)
# test the result
eq_(1, leg_proc._log_job_start.call_count)
leg_proc._log_job_start.assert_called_with(raw_crash.uuid)
eq_(1, m_transform.apply_all_rules.call_count)
m_transform.apply_all_rules.has_calls(
mock.call(raw_crash, leg_proc),
)
eq_(
1,
m_transform.apply_until_action_succeeds.call_count
)
m_transform.apply_all_rules.has_calls(
mock.call(raw_crash, processed_crash, leg_proc)
)
eq_(
1,
leg_proc._create_basic_processed_crash.call_count
)
leg_proc._create_basic_processed_crash.assert_called_with(
raw_crash.uuid,
raw_crash,
datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC),
started_timestamp,
[
'testing_processor:2012',
'LegacyCrashProcessor',
"Pipe dump missing from 'upload_file_minidump'",
"Pipe dump missing from 'aux_dump_001'"
]
)
eq_(
2,
leg_proc._do_breakpad_stack_dump_analysis.call_count
)
first_call, second_call = \
leg_proc._do_breakpad_stack_dump_analysis.call_args_list
eq_(
first_call,
((raw_crash.uuid, '/some/path/%s.dump' % raw_crash.uuid,
0, None, datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC),
[
'testing_processor:2012',
'LegacyCrashProcessor',
"Pipe dump missing from 'upload_file_minidump'",
#.........这里部分代码省略.........
示例5: test_create_basic_processed_crash_normal
# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _create_basic_processed_crash [as 别名]
def test_create_basic_processed_crash_normal(self):
config = setup_config_with_mocks()
config.collect_addon = False
config.collect_crash_process = False
mocked_transform_rules_str = \
'socorro.processor.legacy_processor.TransformRuleSystem'
with mock.patch(mocked_transform_rules_str) as m_transform_class:
m_transform = mock.Mock()
m_transform_class.return_value = m_transform
m_transform.attach_mock(mock.Mock(), 'apply_all_rules')
utc_now_str = 'socorro.processor.legacy_processor.utc_now'
with mock.patch(utc_now_str) as m_utc_now:
m_utc_now.return_value = datetime(2012, 5, 4, 15, 11,
tzinfo=UTC)
started_timestamp = datetime(2012, 5, 4, 15, 10, tzinfo=UTC)
raw_crash = canonical_standard_raw_crash
leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)
processor_notes = []
# test 01
processed_crash = leg_proc._create_basic_processed_crash(
'3bc4bcaa-b61d-4d1f-85ae-30cb32120504',
raw_crash,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
assert 'exploitability' in processed_crash
self.assertEqual(
processed_crash,
dict(cannonical_basic_processed_crash)
)
# test 02
processor_notes = []
raw_crash_missing_product = copy.deepcopy(raw_crash)
del raw_crash_missing_product['ProductName']
processed_crash = leg_proc._create_basic_processed_crash(
'3bc4bcaa-b61d-4d1f-85ae-30cb32120504',
raw_crash_missing_product,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
processed_crash_missing_product = \
copy.copy(cannonical_basic_processed_crash)
processed_crash_missing_product.product = None
self.assertEqual(
processed_crash,
processed_crash_missing_product
)
self.assertTrue('WARNING: raw_crash missing ProductName' in
processor_notes)
self.assertEqual(len(processor_notes), 1)
# test 03
processor_notes = []
raw_crash_missing_version = copy.deepcopy(raw_crash)
del raw_crash_missing_version['Version']
processed_crash = leg_proc._create_basic_processed_crash(
'3bc4bcaa-b61d-4d1f-85ae-30cb32120504',
raw_crash_missing_version,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
processed_crash_missing_version = \
copy.copy(cannonical_basic_processed_crash)
processed_crash_missing_version.version = None
self.assertEqual(
processed_crash,
processed_crash_missing_version
)
self.assertTrue('WARNING: raw_crash missing Version' in
processor_notes)
self.assertEqual(len(processor_notes), 1)
# test 04
processor_notes = []
raw_crash_with_hangid = copy.deepcopy(raw_crash)
raw_crash_with_hangid.HangID = \
'30cb3212-b61d-4d1f-85ae-3bc4bcaa0504'
processed_crash = leg_proc._create_basic_processed_crash(
'3bc4bcaa-b61d-4d1f-85ae-30cb32120504',
raw_crash_with_hangid,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
processed_crash_with_hangid = \
copy.copy(cannonical_basic_processed_crash)
processed_crash_with_hangid.hangid = \
raw_crash_with_hangid.HangID
processed_crash_with_hangid.hang_type = -1
self.assertEqual(
processed_crash,
processed_crash_with_hangid
)
#.........这里部分代码省略.........
示例6: test_convert_raw_crash_to_processed_crash_basic
# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _create_basic_processed_crash [as 别名]
def test_convert_raw_crash_to_processed_crash_basic(self):
config = setup_config_with_mocks()
mocked_transform_rules_str = "socorro.processor.legacy_processor.TransformRuleSystem"
with mock.patch(mocked_transform_rules_str) as m_transform_class:
m_transform = mock.Mock()
m_transform_class.return_value = m_transform
m_transform.attach_mock(mock.Mock(), "apply_all_rules")
utc_now_str = "socorro.processor.legacy_processor.utc_now"
with mock.patch(utc_now_str) as m_utc_now:
m_utc_now.return_value = datetime(2012, 5, 4, 15, 11)
raw_crash = DotDict()
raw_crash.uuid = "3bc4bcaa-b61d-4d1f-85ae-30cb32120504"
raw_crash.submitted_timestamp = "2012-05-04T15:33:33"
raw_dump = "abcdef"
leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)
started_timestamp = datetime(2012, 5, 4, 15, 10)
leg_proc._log_job_start = mock.Mock(return_value=started_timestamp)
basic_processed_crash = DotDict()
basic_processed_crash.uuid = raw_crash.uuid
basic_processed_crash.hang_type = 0
basic_processed_crash.java_stack_trace = None
leg_proc._create_basic_processed_crash = mock.Mock(return_value=basic_processed_crash)
leg_proc._get_temp_dump_pathname = mock.Mock(return_value="/tmp/x")
leg_proc._log_job_end = mock.Mock()
processed_crash_update_dict = DotDict()
processed_crash_update_dict.success = True
leg_proc._do_breakpad_stack_dump_analysis = mock.Mock(return_value=processed_crash_update_dict)
leg_proc._cleanup_temp_file = mock.Mock()
# Here's the call being tested
processed_crash = leg_proc.convert_raw_crash_to_processed_crash(raw_crash, raw_dump)
# test the result
self.assertEqual(1, leg_proc._log_job_start.call_count)
leg_proc._log_job_start.assert_called_with(raw_crash.uuid)
self.assertEqual(1, m_transform.apply_all_rules.call_count)
m_transform.apply_all_rules.assert_called_with(raw_crash, leg_proc)
self.assertEqual(1, leg_proc._create_basic_processed_crash.call_count)
leg_proc._create_basic_processed_crash.assert_called_with(
raw_crash.uuid, raw_crash, datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC), started_timestamp, []
)
self.assertEqual(1, leg_proc._get_temp_dump_pathname.call_count)
leg_proc._get_temp_dump_pathname.assert_called_with(raw_crash.uuid, raw_dump)
self.assertEqual(1, leg_proc._do_breakpad_stack_dump_analysis.call_count)
leg_proc._do_breakpad_stack_dump_analysis.assert_called_with(
raw_crash.uuid, "/tmp/x", 0, None, datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC), []
)
self.assertEqual(1, leg_proc._cleanup_temp_file.call_count)
leg_proc._cleanup_temp_file.assert_called_with("/tmp/x")
self.assertEqual(1, leg_proc._log_job_end.call_count)
leg_proc._log_job_end.assert_called_with(datetime(2012, 5, 4, 15, 11), True, raw_crash.uuid)
epc = DotDict()
epc.uuid = raw_crash.uuid
epc.topmost_filenames = ""
epc.processor_notes = ""
epc.success = True
epc.completeddatetime = datetime(2012, 5, 4, 15, 11)
epc.hang_type = 0
epc.java_stack_trace = None
self.assertEqual(processed_crash, dict(epc))
示例7: test_create_basic_processed_crash_normal
# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _create_basic_processed_crash [as 别名]
def test_create_basic_processed_crash_normal(self):
config = setup_config_with_mocks()
config.collect_addon = False
config.collect_crash_process = False
mocked_transform_rules_str = "socorro.processor.legacy_processor.TransformRuleSystem"
with mock.patch(mocked_transform_rules_str) as m_transform_class:
m_transform = mock.Mock()
m_transform_class.return_value = m_transform
m_transform.attach_mock(mock.Mock(), "apply_all_rules")
utc_now_str = "socorro.processor.legacy_processor.utc_now"
with mock.patch(utc_now_str) as m_utc_now:
m_utc_now.return_value = datetime(2012, 5, 4, 15, 11, tzinfo=UTC)
started_timestamp = datetime(2012, 5, 4, 15, 10, tzinfo=UTC)
raw_crash = canonical_standard_raw_crash
leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)
processor_notes = []
# test 01
processed_crash = leg_proc._create_basic_processed_crash(
"3bc4bcaa-b61d-4d1f-85ae-30cb32120504",
raw_crash,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
assert "exploitability" in processed_crash
self.assertEqual(processed_crash, dict(cannonical_basic_processed_crash))
# test 02
processor_notes = []
raw_crash_missing_product = copy.deepcopy(raw_crash)
del raw_crash_missing_product["ProductName"]
processed_crash = leg_proc._create_basic_processed_crash(
"3bc4bcaa-b61d-4d1f-85ae-30cb32120504",
raw_crash_missing_product,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
processed_crash_missing_product = copy.copy(cannonical_basic_processed_crash)
processed_crash_missing_product.product = None
self.assertEqual(processed_crash, processed_crash_missing_product)
self.assertTrue("WARNING: raw_crash missing ProductName" in processor_notes)
self.assertEqual(len(processor_notes), 1)
# test 03
processor_notes = []
raw_crash_missing_version = copy.deepcopy(raw_crash)
del raw_crash_missing_version["Version"]
processed_crash = leg_proc._create_basic_processed_crash(
"3bc4bcaa-b61d-4d1f-85ae-30cb32120504",
raw_crash_missing_version,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
processed_crash_missing_version = copy.copy(cannonical_basic_processed_crash)
processed_crash_missing_version.version = None
self.assertEqual(processed_crash, processed_crash_missing_version)
self.assertTrue("WARNING: raw_crash missing Version" in processor_notes)
self.assertEqual(len(processor_notes), 1)
# test 04
processor_notes = []
raw_crash_with_hangid = copy.deepcopy(raw_crash)
raw_crash_with_hangid.HangID = "30cb3212-b61d-4d1f-85ae-3bc4bcaa0504"
processed_crash = leg_proc._create_basic_processed_crash(
"3bc4bcaa-b61d-4d1f-85ae-30cb32120504",
raw_crash_with_hangid,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
processed_crash_with_hangid = copy.copy(cannonical_basic_processed_crash)
processed_crash_with_hangid.hangid = raw_crash_with_hangid.HangID
processed_crash_with_hangid.hang_type = -1
self.assertEqual(processed_crash, processed_crash_with_hangid)
self.assertEqual(len(processor_notes), 0)
# test 05
processor_notes = []
raw_crash_with_pluginhang = copy.deepcopy(raw_crash)
raw_crash_with_pluginhang.PluginHang = "1"
processed_crash = leg_proc._create_basic_processed_crash(
"3bc4bcaa-b61d-4d1f-85ae-30cb32120504",
raw_crash_with_pluginhang,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
processed_crash_with_pluginhang = copy.copy(cannonical_basic_processed_crash)
processed_crash_with_pluginhang.hangid = "fake-3bc4bcaa-b61d-4d1f-85ae-30cb32120504"
processed_crash_with_pluginhang.hang_type = -1
self.assertEqual(processed_crash, processed_crash_with_pluginhang)
self.assertEqual(len(processor_notes), 0)
# test 06
processor_notes = []
#.........这里部分代码省略.........
示例8: test_convert_raw_crash_to_processed_crash_basic
# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _create_basic_processed_crash [as 别名]
def test_convert_raw_crash_to_processed_crash_basic(self):
config = setup_config_with_mocks()
mocked_transform_rules_str = "socorro.processor.legacy_processor.TransformRuleSystem"
with mock.patch(mocked_transform_rules_str) as m_transform_class:
m_transform = mock.Mock()
m_transform_class.return_value = m_transform
m_transform.attach_mock(mock.Mock(), "apply_all_rules")
utc_now_str = "socorro.processor.legacy_processor.utc_now"
with mock.patch(utc_now_str) as m_utc_now:
m_utc_now.return_value = datetime(2012, 5, 4, 15, 11, tzinfo=UTC)
raw_crash = DotDict()
raw_crash.uuid = "3bc4bcaa-b61d-4d1f-85ae-30cb32120504"
raw_crash.submitted_timestamp = "2012-05-04T15:33:33"
raw_dump = {
"upload_file_minidump": "/some/path/%s.dump" % raw_crash.uuid,
"aux_dump_001": "/some/path/aux_001.%s.dump" % raw_crash.uuid,
}
leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)
started_timestamp = datetime(2012, 5, 4, 15, 10, tzinfo=UTC)
leg_proc._log_job_start = mock.Mock(return_value=started_timestamp)
basic_processed_crash = DotDict()
basic_processed_crash.uuid = raw_crash.uuid
basic_processed_crash.hang_type = 0
basic_processed_crash.java_stack_trace = None
leg_proc._create_basic_processed_crash = mock.Mock(return_value=basic_processed_crash)
leg_proc._log_job_end = mock.Mock()
processed_crash_update_dict = DotDict()
processed_crash_update_dict.success = True
leg_proc._do_breakpad_stack_dump_analysis = mock.Mock(return_value=processed_crash_update_dict)
leg_proc._cleanup_temp_file = mock.Mock()
# Here's the call being tested
processed_crash = leg_proc.convert_raw_crash_to_processed_crash(raw_crash, raw_dump)
# test the result
self.assertEqual(1, leg_proc._log_job_start.call_count)
leg_proc._log_job_start.assert_called_with(raw_crash.uuid)
self.assertEqual(1, m_transform.apply_all_rules.call_count)
m_transform.apply_all_rules.assert_called_with(raw_crash, leg_proc)
self.assertEqual(1, leg_proc._create_basic_processed_crash.call_count)
leg_proc._create_basic_processed_crash.assert_called_with(
raw_crash.uuid,
raw_crash,
datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC),
started_timestamp,
["testing_processor:2012"],
)
self.assertEqual(2, leg_proc._do_breakpad_stack_dump_analysis.call_count)
first_call, second_call = leg_proc._do_breakpad_stack_dump_analysis.call_args_list
self.assertEqual(
first_call,
(
(
raw_crash.uuid,
"/some/path/%s.dump" % raw_crash.uuid,
0,
None,
datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC),
["testing_processor:2012"],
),
),
)
self.assertEqual(
second_call,
(
(
raw_crash.uuid,
"/some/path/aux_001.%s.dump" % raw_crash.uuid,
0,
None,
datetime(2012, 5, 4, 15, 33, 33, tzinfo=UTC),
["testing_processor:2012"],
),
),
)
self.assertEqual(1, leg_proc._log_job_end.call_count)
leg_proc._log_job_end.assert_called_with(datetime(2012, 5, 4, 15, 11, tzinfo=UTC), True, raw_crash.uuid)
epc = DotDict()
epc.uuid = raw_crash.uuid
epc.topmost_filenames = ""
epc.processor_notes = "testing_processor:2012"
epc.success = True
epc.completeddatetime = datetime(2012, 5, 4, 15, 11, tzinfo=UTC)
epc.hang_type = 0
epc.java_stack_trace = None
epc.Winsock_LSP = None
epc.additional_minidumps = ["aux_dump_001"]
epc.aux_dump_001 = {"success": True}
self.assertEqual(processed_crash, dict(epc))
#.........这里部分代码省略.........
示例9: test_convert_raw_crash_to_processed_crash_unexpected_error
# 需要导入模块: from socorro.processor.legacy_processor import LegacyCrashProcessor [as 别名]
# 或者: from socorro.processor.legacy_processor.LegacyCrashProcessor import _create_basic_processed_crash [as 别名]
def test_convert_raw_crash_to_processed_crash_unexpected_error(self):
config = setup_config_with_mocks()
mocked_transform_rules_str = \
'socorro.processor.legacy_processor.TransformRuleSystem'
with mock.patch(mocked_transform_rules_str) as m_transform_class:
m_transform = mock.Mock()
m_transform_class.return_value = m_transform
m_transform.attach_mock(mock.Mock(), 'apply_all_rules')
utc_now_str = 'socorro.processor.legacy_processor.utc_now'
with mock.patch(utc_now_str) as m_utc_now:
m_utc_now.return_value = datetime(2012, 5, 4, 15, 11)
raw_crash = DotDict()
raw_crash.uuid = '3bc4bcaa-b61d-4d1f-85ae-30cb32120504'
raw_crash.submitted_timestamp = '2012-05-04T15:33:33'
raw_dump = 'abcdef'
leg_proc = LegacyCrashProcessor(config, config.mock_quit_fn)
started_timestamp = datetime(2012, 5, 4, 15, 10)
leg_proc._log_job_start = mock.Mock(
return_value=started_timestamp
)
basic_processed_crash = DotDict()
basic_processed_crash.uuid = raw_crash.uuid
basic_processed_crash.success = False
basic_processed_crash.hang_type = 0
basic_processed_crash.java_stack_trace = None
leg_proc._create_basic_processed_crash = mock.Mock(
return_value=basic_processed_crash)
leg_proc._get_temp_dump_pathname = mock.Mock(
return_value='/tmp/x'
)
leg_proc._log_job_end = mock.Mock()
processed_crash_update_dict = DotDict()
processed_crash_update_dict.success = True
leg_proc._do_breakpad_stack_dump_analysis = mock.Mock(
side_effect=Exception('nobody expects the spanish '
'inquisition')
)
leg_proc._cleanup_temp_file = mock.Mock()
# Here's the call being tested
processed_crash = \
leg_proc.convert_raw_crash_to_processed_crash(
raw_crash,
raw_dump
)
self.assertEqual(
1,
leg_proc._cleanup_temp_file.call_count
)
leg_proc._cleanup_temp_file.assert_called_with('/tmp/x')
self.assertEqual(1, leg_proc._log_job_end.call_count)
leg_proc._log_job_end.assert_called_with(
datetime(2012, 5, 4, 15, 11),
False,
raw_crash.uuid
)
e = {
'processor_notes': 'nobody expects the spanish inquisition',
'completeddatetime': datetime(2012, 5, 4, 15, 11),
'success': False,
'uuid': raw_crash.uuid,
'hang_type': 0,
'java_stack_trace': None,
}
self.assertEqual(e, processed_crash)