def testCountStackWalkerTimeoutKills_fail(self, statsd_obj):
        config = DotDict()
        config.counter_class = Mock()
        config.rule_name = 'stackwalker_timeout_kills'
        config.statsd_class = Mock()
        config.statsd_host = 'some_statsd_host'
        config.statsd_port = 3333
        config.statsd_prefix = ''
        config.active_list = ['stackwalker_timeout_kills']
        a_rule = CountStackWalkerTimeoutKills(config)

        raw_crash_mock = Mock()
        raw_dumps_mock = Mock()
        processed_crash_mock = Mock()
        proc_meta = DotDict()
        proc_meta.processor_notes = [
            'hello',
            'this is a list of notes from the processor',
            'it has information about the what the processor',
            'thought was important',
        ]

        assert not a_rule._predicate(
            raw_crash_mock,
            raw_dumps_mock,
            processed_crash_mock,
            proc_meta
        )
    def testCountStackWalkerTimeoutKills_success(self, statsd_obj):
        config = DotDict()
        config.counter_class = Mock()
        config.rule_name = 'stackwalker_timeout_kills'
        config.statsd_class = Mock()
        config.statsd_host = 'some_statsd_host'
        config.statsd_port = 3333
        config.statsd_prefix = ''
        config.active_list = ['stackwalker_timeout_kills']
        a_rule = CountStackWalkerTimeoutKills(config)

        raw_crash_mock = Mock()
        raw_dumps_mock = Mock()
        processed_crash_mock = Mock()
        proc_meta = DotDict()
        proc_meta.processor_notes = [
            'hello', 'this is a list of notes from the processor',
            'it has information about the what the processor',
            'thought was important', 'like, maybe, SIGKILL of the stackwalker',
            'or other such things.'
        ]

        ok_(
            a_rule._predicate(raw_crash_mock, raw_dumps_mock,
                              processed_crash_mock, proc_meta))

        a_rule._action(raw_crash_mock, raw_dumps_mock, processed_crash_mock,
                       proc_meta)
        a_rule.counter._incr.assert_called_once_with(
            'stackwalker_timeout_kills')