示例#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)
示例#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)
示例#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)
示例#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)
示例#5
0
def test_parse_chronos_log_line_fail():
    assert "" == logs.parse_chronos_log_line("fake timestamp", None, None)
示例#6
0
def test_parse_chronos_log_line_fail():
    assert '' == logs.parse_chronos_log_line("fake timestamp", None, None)