def test_capture_oom_events_from_stdin(mock_sys_stdin, sys_stdin):
    mock_sys_stdin.readline.side_effect = sys_stdin
    test_output = []
    for a_tuple in capture_oom_events_from_stdin():
        test_output.append(a_tuple)

    assert test_output == [(1500316300, "dev37-devc", "a687af92e281", "apache2")]
예제 #2
0
def test_capture_oom_events_from_stdin_with_spaces(
        mock_sys_stdin, sys_stdin_process_name_with_spaces):
    mock_sys_stdin.readline.side_effect = sys_stdin_process_name_with_spaces
    test_output = []
    for a_tuple in capture_oom_events_from_stdin():
        test_output.append(a_tuple)

    assert test_output == [(1500316300, "dev37-devc", "a687af92e281",
                            "python batch/ke")]
예제 #3
0
def test_capture_oom_events_from_stdin_kubernetes(mock_sys_stdin,
                                                  sys_stdin_kubernetes):
    mock_sys_stdin.readline.side_effect = sys_stdin_kubernetes
    test_output = []
    for a_tuple in capture_oom_events_from_stdin():
        test_output.append(a_tuple)

    assert test_output == [(1500316300, "dev37-devc", "0e4a814eda03",
                            "apache2")]
예제 #4
0
def test_capture_oom_events_from_stdin_with_slashes(
        mock_sys_stdin, sys_stdin_process_name_with_slashes):
    mock_sys_stdin.readline.side_effect = sys_stdin_process_name_with_slashes
    test_output = []
    for a_tuple in capture_oom_events_from_stdin():
        test_output.append(a_tuple)

    assert test_output == [(1500316300, 'dev37-devc', 'a687af92e281',
                            '/nail/live/yelp')]
예제 #5
0
def test_capture_oom_events_from_stdin_without_process_name(
        mock_sys_stdin, sys_stdin_without_process_name):
    mock_sys_stdin.readline.side_effect = sys_stdin_without_process_name
    test_output = []
    for a_tuple in capture_oom_events_from_stdin():
        test_output.append(a_tuple)

    assert test_output == [
        (1500216300, "dev37-devc", "e3a1057fdd48", ""),
        (1500316300, "dev37-devc", "a687af92e281", ""),
    ]
예제 #6
0
def test_capture_oom_events_from_stdin_kubernetes_qos(
    mock_sys_stdin,
    sys_stdin_kubernetes_besteffort_qos,
    sys_stdin_kubernetes_burstable_qos,
    sys_stdin_kubernetes_guaranteed_qos,
):
    for qos in (
        sys_stdin_kubernetes_besteffort_qos,
        sys_stdin_kubernetes_burstable_qos,
        sys_stdin_kubernetes_guaranteed_qos,
    ):
        mock_sys_stdin.readline.side_effect = qos
        test_output = []
        for a_tuple in capture_oom_events_from_stdin():
            test_output.append(a_tuple)
        assert test_output == [(1500316300, "dev37-devc", "0e4a814eda03", "apache2")]