Пример #1
0
def test_ignore_results():
    result1 = IgnoreResults()
    result2 = IgnoreResults("Login to DB failed")
    assert repr(result1) == "IgnoreResults('currently no results')"
    assert str(result2) == "Login to DB failed"
    assert result1 != result2
    assert result2 == IgnoreResults("Login to DB failed")
Пример #2
0
def test_ignore_results():
    result1 = IgnoreResults()
    result2 = IgnoreResults("Login to DB failed")
    assert repr(result1) == "IgnoreResults('currently no results')"
    assert str(result2) == "Login to DB failed"
    assert result1 != result2
    assert result2 == IgnoreResults("Login to DB failed")
    with pytest.raises(TypeError):
        assert result1 == "a string"
Пример #3
0
def _simple_check(section: Iterable[int]) -> CheckResult:
    """just a simple way to create test check results"""
    for value in section:
        try:
            yield Result(state=State(value), summary="Hi")
        except ValueError:
            if value == -1:
                yield IgnoreResults("yielded")
            elif value == -2:
                raise IgnoreResultsError("raised")
            else:
                yield Metric("n", value)
Пример #4
0
 def _consume_checkresult(
     self,
     node: str,
     result_generator: CheckResult,
 ) -> Sequence[Union[Result, Metric, IgnoreResults]]:
     with load_host_value_store(
             node,
             store_changes=self._persist_value_store_changes,
     ) as value_store_manager:
         with value_store_manager.namespace(self._service_id):
             try:
                 return list(result_generator)
             except IgnoreResultsError as exc:
                 return [IgnoreResults(str(exc))]
def test_node_ignore_results():
    node_results = _check_function_node((_OK_RESULT, IgnoreResults()))
    assert aggregate_node_details("test_node", node_results) is None
Пример #6
0
def test_node_ignore_results():
    node_results = _check_function_node((_OK_RESULT, IgnoreResults()))
    assert list(make_node_notice_results("test_node", node_results)) == []