def test_stuff_missing(self):
        config = get_basic_config()

        raw_crash = copy.copy(canonical_standard_raw_crash)
        del raw_crash.uuid
        expected_raw_crash = copy.copy(raw_crash)

        raw_dumps = {}
        processed_crash = DotDict()
        processor_meta = get_basic_processor_meta()

        rule = IdentifierRule(config)

        # the call to be tested
        result = rule.act(
            raw_crash,
            raw_dumps,
            processed_crash,
            processor_meta
        )

        assert result == (True, False)

        # raw crash should be unchanged
        assert raw_crash == expected_raw_crash
    def test_rule_with_dict(self):
        raw_crash = {'key1': 'val1', b'\0key2': b'val2\0', '\0key3': '\0val3'}

        config = get_basic_config()
        rule = DeNullRule(config)
        rule.act(raw_crash, {}, {}, get_basic_processor_meta())

        assert raw_crash == {'key1': 'val1', b'key2': b'val2', 'key3': 'val3'}
Exemple #3
0
    def test_hash_not_in_raw_crash(self):
        config = get_basic_config()

        raw_crash = DotDict()
        raw_dumps = {}
        processed_crash = DotDict()
        processor_meta = get_basic_processor_meta()

        rule = MinidumpSha256Rule(config)
        assert rule.predicate(raw_crash, raw_dumps, processed_crash, processor_meta) is False
Exemple #4
0
 def get_basic_config(self):
     config = get_basic_config()
     config.dump_field = 'upload_file_minidump'
     config.command_line = BreakpadStackwalkerRule2015.required_config.command_line.default
     config.kill_timeout = 5
     config.command_pathname = '/bin/stackwalker'
     config.symbols_urls = ['https://example.com']
     config.symbol_cache_path = '/mnt/socorro/symbols'
     config.symbol_tmp_path = '/mnt/socorro/symbols'
     config.temporary_file_system_storage_path = '/tmp'
     return config
Exemple #5
0
    def test_everything_we_hoped_for(self):
        config = get_basic_config()

        raw_crash = copy.copy(canonical_standard_raw_crash)
        raw_dumps = {}
        processed_crash = DotDict()
        processed_crash.json_dump = copy.copy(canonical_stackwalker_output)
        processor_meta = get_basic_processor_meta()

        rule = CrashingThreadRule(config)
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        assert processed_crash.crashedThread == 0
Exemple #6
0
    def test_everything_we_hoped_for(self):
        config = get_basic_config()

        uuid = '00000000-0000-0000-0000-000002140504'
        raw_crash = {'uuid': uuid}
        raw_dumps = {}
        processed_crash = {}
        processor_meta = get_basic_processor_meta()

        rule = IdentifierRule(config)
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        assert processed_crash['crash_id'] == uuid
        assert processed_crash['uuid'] == uuid
Exemple #7
0
    def test_uuid_missing(self):
        config = get_basic_config()

        raw_crash = {}
        raw_dumps = {}
        processed_crash = {}
        processor_meta = get_basic_processor_meta()

        rule = IdentifierRule(config)
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        # raw crash and processed crashes should be unchanged
        assert raw_crash == {}
        assert processed_crash == {}
    def test_uuid_missing(self):
        config = get_basic_config()

        raw_crash = {}
        raw_dumps = {}
        processed_crash = {}
        processor_meta = get_basic_processor_meta()

        rule = IdentifierRule(config)
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        # raw crash and processed crashes should be unchanged
        assert raw_crash == {}
        assert processed_crash == {}
Exemple #9
0
    def test_stuff_missing(self):
        config = get_basic_config()

        raw_crash = copy.copy(canonical_standard_raw_crash)
        raw_dumps = {}
        processed_crash = DotDict()
        processed_crash.json_dump = {}
        processor_meta = get_basic_processor_meta()

        rule = CrashingThreadRule(config)
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        assert processed_crash.crashedThread is None
        assert processor_meta.processor_notes == ['MDSW did not identify the crashing thread']
    def test_hash_in_raw_crash(self):
        config = get_basic_config()

        raw_crash = DotDict({'MinidumpSha256Hash': 'hash'})
        raw_dumps = {}
        processed_crash = DotDict()
        processor_meta = get_basic_processor_meta()

        rule = MinidumpSha256Rule(config)
        assert rule.predicate(raw_crash, raw_dumps, processed_crash,
                              processor_meta) is True

        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)
        assert processed_crash['minidump_sha256_hash'] == 'hash'
    def test_hash_in_raw_crash(self):
        config = get_basic_config()

        raw_crash = DotDict({
            'MinidumpSha256Hash': 'hash'
        })
        raw_dumps = {}
        processed_crash = DotDict()
        processor_meta = get_basic_processor_meta()

        rule = MinidumpSha256Rule(config)
        assert rule.predicate(raw_crash, raw_dumps, processed_crash, processor_meta) is True

        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)
        assert processed_crash['minidump_sha256_hash'] == 'hash'
    def test_rule_with_dict(self):
        raw_crash = {
            'key1': 'val1',
            b'\0key2': b'val2\0',
            '\0key3': '\0val3'
        }

        config = get_basic_config()
        rule = DeNullRule(config)
        rule.act(raw_crash, {}, {}, get_basic_processor_meta())

        assert raw_crash == {
            'key1': 'val1',
            b'key2': b'val2',
            'key3': 'val3'
        }
    def test_everything_we_hoped_for(self):
        config = get_basic_config()

        uuid = '00000000-0000-0000-0000-000002140504'
        raw_crash = {
            'uuid': uuid
        }
        raw_dumps = {}
        processed_crash = {}
        processor_meta = get_basic_processor_meta()

        rule = IdentifierRule(config)
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        assert processed_crash['crash_id'] == uuid
        assert processed_crash['uuid'] == uuid
 def get_basic_config(self):
     config = get_basic_config()
     config.dump_field = 'upload_file_minidump'
     config.command_line = ('timeout -s KILL 30 {command_pathname} '
                            '{dump_file_pathname} '
                            '{processor_symbols_pathname_list} 2>/dev/null')
     config.command_pathname = 'bogus_command'
     config.processor_symbols_pathname_list = (
         '/mnt/socorro/symbols/symbols_ffx,'
         '/mnt/socorro/symbols/symbols_sea,'
         '/mnt/socorro/symbols/symbols_tbrd,'
         '/mnt/socorro/symbols/symbols_sbrd,'
         '/mnt/socorro/symbols/symbols_os')
     config.symbol_cache_path = '/mnt/socorro/symbols'
     config.result_key = 'bogus_command_result'
     config.return_code_key = 'bogus_command_return_code'
     return config
    def test_rule_with_dotdict(self):
        # NOTE(willkg): DotDict doesn't like bytes keys
        raw_crash = DotDict({
            'key1': 'val1',
            '\0key2': b'val2\0',
            '\0key3': '\0val3'
        })

        config = get_basic_config()
        rule = DeNullRule(config)
        rule.act(raw_crash, {}, {}, get_basic_processor_meta())

        assert raw_crash == DotDict({
            'key1': 'val1',
            'key2': b'val2',
            'key3': 'val3'
        })
    def test_rule_with_dotdict(self):
        # NOTE(willkg): DotDict doesn't like bytes keys
        raw_crash = DotDict({
            'key1': 'val1',
            '\0key2': b'val2\0',
            '\0key3': '\0val3'
        })

        config = get_basic_config()
        rule = DeNullRule(config)
        rule.act(raw_crash, {}, {}, get_basic_processor_meta())

        assert raw_crash == DotDict({
            'key1': 'val1',
            'key2': b'val2',
            'key3': 'val3'
        })
    def test_stuff_missing(self):
        config = get_basic_config()
        raw_crash = {}
        processed_crash = DotDict()
        processor_meta = get_basic_processor_meta()

        rule = OSInfoRule(config)

        # the call to be tested
        rule.act(raw_crash, {}, processed_crash, processor_meta)

        # processed crash should have empties
        assert processed_crash['os_name'] == 'Unknown'
        assert processed_crash['os_version'] == ''

        # raw crash should be unchanged
        assert raw_crash == {}
Exemple #18
0
    def test_stuff_missing(self):
        config = get_basic_config()
        raw_crash = {}
        processed_crash = DotDict()
        processor_meta = get_basic_processor_meta()

        rule = OSInfoRule(config)

        # the call to be tested
        rule.act(raw_crash, {}, processed_crash, processor_meta)

        # processed crash should have empties
        assert processed_crash['os_name'] == 'Unknown'
        assert processed_crash['os_version'] == ''

        # raw crash should be unchanged
        assert raw_crash == {}
Exemple #19
0
    def test_missing_json_dump(self):
        config = get_basic_config()

        raw_crash = {}
        raw_dumps = {}
        processed_crash = {}
        processor_meta = get_basic_processor_meta()

        rule = CPUInfoRule(config)

        # the call to be tested
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        assert processed_crash['cpu_info'] == ''
        assert processed_crash['cpu_name'] == ''

        # raw crash should be unchanged
        assert raw_crash == {}
    def test_missing_json_dump(self):
        config = get_basic_config()

        raw_crash = {}
        raw_dumps = {}
        processed_crash = {}
        processor_meta = get_basic_processor_meta()

        rule = CPUInfoRule(config)

        # the call to be tested
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        assert processed_crash['cpu_info'] == ''
        assert processed_crash['cpu_name'] == ''

        # raw crash should be unchanged
        assert raw_crash == {}
    def test_everything_we_hoped_for(self):
        config = get_basic_config()

        raw_crash = copy.copy(canonical_standard_raw_crash)
        raw_dumps = {}
        processed_crash = DotDict()
        processor_meta = get_basic_processor_meta()

        rule = IdentifierRule(config)

        # the call to be tested
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        assert processed_crash.crash_id == "00000000-0000-0000-0000-000002140504"
        assert processed_crash.uuid == "00000000-0000-0000-0000-000002140504"

        # raw crash should be unchanged
        assert raw_crash == canonical_standard_raw_crash
    def test_everything_we_hoped_for(self):
        config = get_basic_config()

        raw_crash = copy.copy(canonical_standard_raw_crash)
        raw_dumps = {}
        processed_crash = copy.copy(canonical_processed_crash)
        processor_meta = get_basic_processor_meta()

        rule = CPUInfoRule(config)

        # the call to be tested
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        assert processed_crash.cpu_info == 'GenuineIntel family 6 model 42 stepping 7 | 4'
        assert processed_crash.cpu_name == 'x86'

        # raw crash should be unchanged
        assert raw_crash == canonical_standard_raw_crash
    def test_everything_we_hoped_for(self):
        config = get_basic_config()

        raw_crash = copy.copy(canonical_standard_raw_crash)
        raw_dumps = {}
        processed_crash = copy.copy(canonical_processed_crash)
        processor_meta = get_basic_processor_meta()

        rule = CPUInfoRule(config)

        # the call to be tested
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        assert processed_crash.cpu_name == 'x86'
        assert processed_crash.cpu_info == 'GenuineIntel family 6 model 42 stepping 7'
        assert processed_crash.cpu_count == 4

        # raw crash should be unchanged
        assert raw_crash == canonical_standard_raw_crash
 def get_basic_config(self):
     config = get_basic_config()
     config.dump_field = 'upload_file_minidump'
     config.command_line = (
         'timeout -s KILL 30 {command_pathname} '
         '{dump_file_pathname} '
         '{processor_symbols_pathname_list}'
     )
     config.command_pathname = 'bogus_command'
     config.processor_symbols_pathname_list = (
         '/mnt/socorro/symbols/symbols_ffx,'
         '/mnt/socorro/symbols/symbols_sea,'
         '/mnt/socorro/symbols/symbols_tbrd,'
         '/mnt/socorro/symbols/symbols_sbrd,'
         '/mnt/socorro/symbols/symbols_os'
     )
     config.symbol_cache_path = '/mnt/socorro/symbols'
     config.result_key = 'bogus_command_result'
     config.return_code_key = 'bogus_command_return_code'
     return config
Exemple #25
0
    def test_missing_cpu_count(self):
        config = get_basic_config()

        raw_crash = copy.copy(canonical_standard_raw_crash)
        raw_dumps = {}
        system_info = copy.copy(
            canonical_processed_crash['json_dump']['system_info'])
        del system_info['cpu_count']
        processed_crash = DotDict()
        processed_crash.json_dump = {'system_info': system_info}
        processor_meta = get_basic_processor_meta()

        rule = CPUInfoRule(config)

        # the call to be tested
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        assert processed_crash.cpu_info == 'GenuineIntel family 6 model 42 stepping 7'
        assert processed_crash.cpu_name == 'x86'

        # raw crash should be unchanged
        assert raw_crash == canonical_standard_raw_crash
Exemple #26
0
    def test_everything_we_hoped_for(self):
        config = get_basic_config()
        raw_crash = {}
        processed_crash = DotDict({
            'json_dump': {
                'system_info': {
                    'os': 'Windows NT',
                    'os_ver': '6.1.7601 Service Pack 1'
                }
            }
        })
        processor_meta = get_basic_processor_meta()

        rule = OSInfoRule(config)

        # the call to be tested
        rule.act(raw_crash, {}, processed_crash, processor_meta)

        assert processed_crash['os_name'] == "Windows NT"
        assert processed_crash['os_version'] == "6.1.7601 Service Pack 1"

        # raw crash should be unchanged
        assert raw_crash == {}
    def test_missing_cpu_count(self):
        config = get_basic_config()

        raw_crash = copy.copy(canonical_standard_raw_crash)
        raw_dumps = {}
        system_info = copy.copy(canonical_processed_crash['json_dump']['system_info'])
        del system_info['cpu_count']
        processed_crash = DotDict()
        processed_crash.json_dump = {
            'system_info': system_info
        }
        processor_meta = get_basic_processor_meta()

        rule = CPUInfoRule(config)

        # the call to be tested
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        assert processed_crash.cpu_info == 'GenuineIntel family 6 model 42 stepping 7'
        assert processed_crash.cpu_name == 'x86'

        # raw crash should be unchanged
        assert raw_crash == canonical_standard_raw_crash
    def test_everything_we_hoped_for(self):
        config = get_basic_config()
        raw_crash = {}
        processed_crash = DotDict({
            'json_dump': {
                'system_info': {
                    'os': 'Windows NT',
                    'os_ver': '6.1.7601 Service Pack 1'
                }
            }
        })
        processor_meta = get_basic_processor_meta()

        rule = OSInfoRule(config)

        # the call to be tested
        rule.act(raw_crash, {}, processed_crash, processor_meta)

        assert processed_crash['os_name'] == "Windows NT"
        assert processed_crash['os_version'] == "6.1.7601 Service Pack 1"

        # raw crash should be unchanged
        assert raw_crash == {}
 def test_de_null(self, data, expected):
     config = get_basic_config()
     rule = DeNullRule(config)
     assert rule.de_null(data) == expected
 def test_de_null(self, data, expected):
     config = get_basic_config()
     rule = DeNullRule(config)
     assert rule.de_null(data) == expected