コード例 #1
0
def test_check_fileinfo_group_patterns(info, group_pattern, expected_result):
    assert expected_result == list(
        fileinfo_plugin.check_fileinfo_groups(
            "banana",
            group_pattern,
            fileinfo_utils.parse_fileinfo(info),
        ))
コード例 #2
0
def test_check_fileinfo_group_no_files(info, parsed, discovery_params, expected_result):
    """Test that the check returns an OK status when there are no files."""
    assert fileinfo_utils.parse_fileinfo(info) == parsed
    assert not list(fileinfo_plugin.discovery_fileinfo_groups(discovery_params, parsed))
    assert expected_result == list(
        fileinfo_plugin.check_fileinfo_groups(
            "banana",
            {"group_patterns": [("/banana/*", "")]},
            parsed,
        )
    )
コード例 #3
0
def test_check_fileinfo_group_no_matching_files(info, parsed, expected_result):
    """Test that the check returns an OK status if there are no matching files."""

    actual_parsed = fileinfo_utils.parse_fileinfo(info)
    assert parsed.reftime == actual_parsed.reftime
    assert list(parsed.files) == list(actual_parsed.files)
    assert expected_result == list(
        fileinfo_plugin.check_fileinfo_groups(
            "banana",
            {"group_patterns": [("/banana/*", "")]},
            parsed,
        ))
コード例 #4
0
def test_check_fileinfo_group_patterns_host_extra_conf(item, params,
                                                       expected_result):
    assert (list(
        fileinfo_plugin.check_fileinfo_groups(
            item,
            params,
            Fileinfo(
                reftime=1619516613,
                files={
                    "/sms/checked/bla":
                    FileinfoItem(
                        name="/sms/checked/bla",
                        missing=False,
                        failed=False,
                        size=0,
                        time=1619515730,
                    )
                },
            ),
        )) == expected_result)
コード例 #5
0
def test_fileinfo_groups_check(info, item, params, expected_result):
    section = fileinfo_utils.parse_fileinfo(info)

    check_result = fileinfo_plugin.check_fileinfo_groups(item, params, section)
    assert list(check_result) == expected_result