Ejemplo n.º 1
0
def test_chronos_log_line_passes_filter_true_when_service_name_in_string():
    service = "fake_service"
    levels = []
    components = []
    clusters = []
    line = format_log_line(
        "fake_level", clusters, service, "fake_instance", "chronos", "fake message with service name %s" % service
    )
    with mock.patch("paasta_tools.chronos_tools.compose_job_id", autospec=True) as format_job_id_patch:
        format_job_id_patch.return_value = service
        assert logs.chronos_log_line_passes_filter(line, levels, service, components, clusters)
Ejemplo n.º 2
0
def test_chronos_log_line_passes_filter_true_when_service_name_in_string():
    service = 'fake_service'
    levels = []
    components = []
    clusters = []
    line = format_log_line(
        'fake_level',
        clusters,
        'fake_instance',
        'chronos',
        'fake message with service name %s' % service,
    )
    with mock.patch('paasta_tools.chronos_tools.compose_job_id', autospec=True) as format_job_id_patch:
        format_job_id_patch.return_value = service
        assert logs.chronos_log_line_passes_filter(line, levels, service, components, clusters)
Ejemplo n.º 3
0
def test_chronos_log_line_passes_filter_fails_invalid_json():
    assert not logs.chronos_log_line_passes_filter("{ abcd }", None, None, None, None)