Exemplo n.º 1
0
def test_cleaning_up_latency_data():
    manager = TelemetryManager()
    manager.MAXIMUM_LATENCY_DATA_AGE = 1

    for i in range(0, 10):
        manager.store_latency(i, PNOperationType.PNPublishOperation)

    # await for store timestamp expired
    time.sleep(2)

    manager.clean_up_telemetry_data()
    print(manager.latencies)

    assert len(manager.operation_latencies()) == 0
Exemplo n.º 2
0
def test_valid_queries():
    manager = TelemetryManager()

    manager.store_latency(1, PNOperationType.PNPublishOperation)
    manager.store_latency(2, PNOperationType.PNPublishOperation)
    manager.store_latency(3, PNOperationType.PNPublishOperation)
    manager.store_latency(4, PNOperationType.PNHistoryOperation)
    manager.store_latency(5, PNOperationType.PNHistoryOperation)
    manager.store_latency(6, PNOperationType.PNHistoryOperation)
    manager.store_latency(7, PNOperationType.PNRemoveGroupOperation)
    manager.store_latency(8, PNOperationType.PNRemoveGroupOperation)
    manager.store_latency(9, PNOperationType.PNRemoveGroupOperation)

    queries = manager.operation_latencies()

    if not queries['l_pub'] == 2:
        raise AssertionError()
    if not queries['l_hist'] == 5:
        raise AssertionError()
    if not queries['l_cg'] == 8:
        raise AssertionError()
Exemplo n.º 3
0
def test_valid_queries():
    manager = TelemetryManager()

    manager.store_latency(1, PNOperationType.PNPublishOperation)
    manager.store_latency(2, PNOperationType.PNPublishOperation)
    manager.store_latency(3, PNOperationType.PNPublishOperation)
    manager.store_latency(4, PNOperationType.PNHistoryOperation)
    manager.store_latency(5, PNOperationType.PNHistoryOperation)
    manager.store_latency(6, PNOperationType.PNHistoryOperation)
    manager.store_latency(7, PNOperationType.PNRemoveGroupOperation)
    manager.store_latency(8, PNOperationType.PNRemoveGroupOperation)
    manager.store_latency(9, PNOperationType.PNRemoveGroupOperation)

    queries = manager.operation_latencies()

    if not queries['l_pub'] == 2:
        raise AssertionError()
    if not queries['l_hist'] == 5:
        raise AssertionError()
    if not queries['l_cg'] == 8:
        raise AssertionError()