コード例 #1
0
ファイル: test_check_oom_events.py プロジェクト: Yelp/paasta
def test_compose_sensu_status_unknown(instance_config):
    assert compose_sensu_status(
        instance=instance_config,
        oom_events=[],
        is_check_enabled=False,
        alert_threshold=1,
        check_interval=1,
    ) == (Status.OK, "This check is disabled for fake_service.fake_instance.")
コード例 #2
0
def test_compose_sensu_status_below_threshold(instance_config):
    assert (compose_sensu_status(
        instance=instance_config,
        oom_events={"container_id1", "container_id2", "container_id3"},
        is_check_enabled=True,
        alert_threshold=5,
        check_interval=1,
    ) is None)
コード例 #3
0
ファイル: test_check_oom_events.py プロジェクト: Yelp/paasta
def test_compose_sensu_status_ok(instance_config):
    assert compose_sensu_status(
        instance=instance_config,
        oom_events=[],
        is_check_enabled=True,
        alert_threshold=1,
        check_interval=1,
    ) == (
        Status.OK,
        "No oom events for fake_service.fake_instance in the last 1 minute(s).",
    )
コード例 #4
0
ファイル: test_check_oom_events.py プロジェクト: Yelp/paasta
def test_compose_sensu_status_not_ok(instance_config):
    assert compose_sensu_status(
        instance=instance_config,
        oom_events={"container_id1", "container_id2", "container_id3"},
        is_check_enabled=True,
        alert_threshold=2,
        check_interval=1,
    ) == (
        Status.CRITICAL,
        "The Out Of Memory killer killed processes for fake_service.fake_instance"
        " in the last 1 minute(s).",
    )
コード例 #5
0
def test_compose_sensu_status_not_ok(instance_config):
    assert compose_sensu_status(
        instance=instance_config, oom_events=[
            OOMEvent('hostname1', 'container_id1', 'proc_A'),
            OOMEvent('hostname3', 'container_id3', 'proc_C'),
            OOMEvent('hostname2', 'container_id2', 'proc_B'),
            OOMEvent('hostname2', 'container_id2', ''),
        ], is_check_enabled=True,
    ) == (
        Status.CRITICAL, 'The Out Of Memory killer killed 4 processes (proc_A,proc_B,proc_C)'
                         ' in the last minute in fake_service.fake_instance containers.',
    )
def test_compose_sensu_status_not_ok(instance_config):
    assert compose_sensu_status(
        instance=instance_config,
        oom_events=[
            OOMEvent("hostname1", "container_id1", "proc_A"),
            OOMEvent("hostname3", "container_id3", "proc_C"),
            OOMEvent("hostname2", "container_id2", "proc_B"),
            OOMEvent("hostname2", "container_id2", ""),
        ],
        is_check_enabled=True,
    ) == (
        Status.CRITICAL,
        "The Out Of Memory killer killed 4 processes (proc_A,proc_B,proc_C)"
        " in the last minute in fake_service.fake_instance containers.",
    )
def test_compose_sensu_status_ok(instance_config):
    assert compose_sensu_status(
        instance=instance_config, oom_events=[], is_check_enabled=True) == (
            Status.OK,
            "No oom events for fake_service.fake_instance in the last minute.")
コード例 #8
0
def test_compose_sensu_status_unknown(instance_config):
    assert compose_sensu_status(instance=instance_config, oom_events=[], is_check_enabled=False) \
        == (Status.OK, 'This check is disabled for fake_service.fake_instance.')