Exemplo n.º 1
0
def test_latest_oom_events(mock_scribereader, scribereader_output):
    mock_scribereader.get_default_scribe_hosts.return_value = [{'host': '', 'port': ''}]
    mock_scribereader.get_stream_tailer.return_value = scribereader_output
    events = latest_oom_events('fake_cluster', 'fake_superregion')
    assert len(events.get(('fake_service1', 'fake_instance1'), [])) == 1
    assert len(events.get(('fake_service2', 'fake_instance2'), [])) == 1
    assert len(events.get(('fake_service3', 'fake_instance3'), [])) == 0
Exemplo n.º 2
0
def test_latest_oom_events(mock_scribereader, scribereader_output):
    mock_scribereader.get_tail_host_and_port.return_value = "localhost", 12345
    mock_scribereader.get_stream_tailer.return_value = scribereader_output
    events = latest_oom_events("fake_cluster", "fake_superregion")
    # Events from the same container count as one
    assert len(events.get(("fake_service1", "fake_instance1"), [])) == 1
    assert len(events.get(("fake_service2", "fake_instance2"), [])) == 2
    assert len(events.get(("fake_service3", "fake_instance3"), [])) == 0
Exemplo n.º 3
0
def test_latest_oom_events_interval(mock_scribereader, scribereader_output):
    mock_scribereader.get_default_scribe_hosts.return_value = [{
        "host": "",
        "port": ""
    }]
    mock_scribereader.get_stream_tailer.return_value = scribereader_output
    events = latest_oom_events("fake_cluster", "fake_superregion", interval=10)
    # Scribereader mocks are more than 10 seconds ago, so no events should be returned
    assert len(events) == 0
def test_latest_oom_events(mock_scribereader, scribereader_output):
    mock_scribereader.get_default_scribe_hosts.return_value = [{
        "host": "",
        "port": ""
    }]
    mock_scribereader.get_stream_tailer.return_value = scribereader_output
    events = latest_oom_events("fake_cluster", "fake_superregion")
    assert len(events.get(("fake_service1", "fake_instance1"), [])) == 1
    assert len(events.get(("fake_service2", "fake_instance2"), [])) == 1
    assert len(events.get(("fake_service3", "fake_instance3"), [])) == 0
Exemplo n.º 5
0
def test_latest_oom_events_interval(mock_scribereader, scribereader_output):
    mock_scribereader.get_tail_host_and_port.return_value = "localhost", 12345
    mock_scribereader.get_stream_tailer.return_value = scribereader_output
    events = latest_oom_events("fake_cluster", "fake_superregion", interval=10)
    # Scribereader mocks are more than 10 seconds ago, so no events should be returned
    assert len(events) == 0