Beispiel #1
0
def test_parse_chronos_log_line_ok():
    fake_timestamp = '2015-07-22T10:38:46-07:00'
    fake_utc_timestamp = '2015-07-22T17:38:46.000000'

    line = '%s this is a fake syslog test message' % fake_timestamp
    clusters = ['fake_cluster']
    expected = json.dumps({
        'timestamp': fake_utc_timestamp,
        'component': 'chronos',
        'cluster': clusters[0],
        'instance': 'ALL',
        'level': 'event',
        'message': line
    })
    assert sorted(logs.parse_chronos_log_line(line, clusters)) == sorted(expected)
Beispiel #2
0
def test_parse_chronos_log_line_ok():
    fake_timestamp = '2015-07-22T10:38:46-07:00'
    fake_utc_timestamp = '2015-07-22T17:38:46.000000'

    line = '%s this is a fake syslog test message' % fake_timestamp
    clusters = ['fake_cluster']
    expected = json.dumps({
        'timestamp': fake_utc_timestamp,
        'component': 'chronos',
        'cluster': clusters[0],
        'instance': 'ALL',
        'level': 'event',
        'message': line
    })
    assert sorted(logs.parse_chronos_log_line(line, clusters)) == sorted(expected)
Beispiel #3
0
def test_parse_chronos_log_line_ok():
    fake_timestamp = "2015-07-22T10:38:46-07:00"
    fake_utc_timestamp = "2015-07-22T17:38:46.000000"
    fake_service = "fake_service"

    line = "%s this is a fake syslog test message" % fake_timestamp
    clusters = ["fake_cluster"]
    expected = json.dumps({
        "timestamp": fake_utc_timestamp,
        "component": "chronos",
        "cluster": clusters[0],
        "service": fake_service,
        "instance": "ALL",
        "level": "event",
        "message": line,
    })
    assert sorted(logs.parse_chronos_log_line(
        line, clusters, fake_service)) == sorted(expected)
Beispiel #4
0
def test_parse_chronos_log_line_ok():
    fake_timestamp = "2015-07-22T10:38:46-07:00"
    fake_utc_timestamp = "2015-07-22T17:38:46.000000"
    fake_service = "fake_service"

    line = "%s this is a fake syslog test message" % fake_timestamp
    clusters = ["fake_cluster"]
    expected = json.dumps(
        {
            "timestamp": fake_utc_timestamp,
            "component": "chronos",
            "cluster": clusters[0],
            "service": fake_service,
            "instance": "ALL",
            "level": "event",
            "message": line,
        }
    )
    assert sorted(logs.parse_chronos_log_line(line, clusters, fake_service)) == sorted(expected)
Beispiel #5
0
def test_parse_chronos_log_line_fail():
    assert "" == logs.parse_chronos_log_line("fake timestamp", None, None)
def test_parse_chronos_log_line_fail():
    assert '' == logs.parse_chronos_log_line("fake timestamp", None, None)