예제 #1
0
def test_paasta_log_line_passes_filter_true_when_default_cluster():
    service = 'fake_service'
    levels = ['fake_level1', 'fake_level2']
    clusters = ['fake_cluster1', 'fake_cluster2']
    instance = 'fake_instance'
    components = ['build', 'deploy']
    line = 'fake_line'
    formatted_line = format_log_line(levels[0], ANY_CLUSTER, instance, components[0], line)
    assert logs.paasta_log_line_passes_filter(formatted_line, levels, service, components, clusters) is True
예제 #2
0
def test_paasta_log_line_passes_filter_false_when_wrong_level():
    service = 'fake_service'
    levels = ['fake_level1', 'fake_level2']
    clusters = ['fake_cluster1', 'fake_cluster2']
    instance = 'fake_instance'
    components = ['build', 'deploy']
    line = 'fake_line'
    formatted_line = format_log_line('BOGUS_LEVEL', clusters[0], instance, components[0], line)
    assert logs.paasta_log_line_passes_filter(formatted_line, levels, service, components, clusters) is False
예제 #3
0
def test_paasta_log_line_passes_filter_false_when_line_not_valid_json():
    service = 'fake_service'
    levels = ['fake_level1', 'fake_level2']
    clusters = ['fake_cluster1', 'fake_cluster2']
    components = ['build', 'deploy']
    line = 'i am definitely not json'
    # component must be legit as well as not in the list of requested
    # components
    assert logs.paasta_log_line_passes_filter(line, levels, service, components, clusters) is False
예제 #4
0
def test_paasta_log_line_passes_filter_false_when_line_not_valid_json():
    service = 'fake_service'
    levels = ['fake_level1', 'fake_level2']
    clusters = ['fake_cluster1', 'fake_cluster2']
    components = ['build', 'deploy']
    line = 'i am definitely not json'
    # component must be legit as well as not in the list of requested
    # components
    assert logs.paasta_log_line_passes_filter(line, levels, service,
                                              components, clusters) is False
예제 #5
0
def test_paasta_log_line_passes_filter_false_when_wrong_component():
    service = 'fake_service'
    levels = ['fake_level1', 'fake_level2']
    clusters = ['fake_cluster1', 'fake_cluster2']
    instance = 'fake_instance'
    components = ['build', 'deploy']
    line = 'fake_line'
    # component must be legit as well as not in the list of requested
    # components
    formatted_line = format_log_line(levels[0], clusters[0], instance, 'monitoring', line)
    assert logs.paasta_log_line_passes_filter(formatted_line, levels, service, components, clusters) is False
예제 #6
0
def test_paasta_log_line_passes_filter_false_when_wrong_level():
    service = 'fake_service'
    levels = ['fake_level1', 'fake_level2']
    clusters = ['fake_cluster1', 'fake_cluster2']
    instance = 'fake_instance'
    components = ['build', 'deploy']
    line = 'fake_line'
    formatted_line = format_log_line('BOGUS_LEVEL', clusters[0], instance,
                                     components[0], line)
    assert logs.paasta_log_line_passes_filter(formatted_line, levels, service,
                                              components, clusters) is False
예제 #7
0
def test_paasta_log_line_passes_filter_true_when_default_cluster():
    service = 'fake_service'
    levels = ['fake_level1', 'fake_level2']
    clusters = ['fake_cluster1', 'fake_cluster2']
    instance = 'fake_instance'
    components = ['build', 'deploy']
    line = 'fake_line'
    formatted_line = format_log_line(levels[0], ANY_CLUSTER, instance,
                                     components[0], line)
    assert logs.paasta_log_line_passes_filter(formatted_line, levels, service,
                                              components, clusters) is True
예제 #8
0
def test_paasta_log_line_passes_filter_false_when_wrong_cluster():
    service = 'fake_service'
    levels = ['fake_level1', 'fake_level2']
    clusters = ['fake_cluster1', 'fake_cluster2']
    instance = 'fake_instance'
    components = ['build', 'deploy']
    line = 'fake_line'
    # component must be legit as well as not in the list of requested
    # components
    formatted_line = format_log_line(levels[0], 'BOGUS_CLUSTER', instance,
                                     components[0], line)
    assert logs.paasta_log_line_passes_filter(formatted_line, levels, service,
                                              components, clusters) is False