Esempio n. 1
0
def test_count(platform="MK", distributed=False):
    # generate the filter code
    result = generate_filter("count.cql", ["count.cc"], distributed)
    assert result == util.EXIT_SUCCESS

    # bootstrap the filter
    storage_proc = bootstrap(distributed)

    # first request
    log.info("Sending request #1")
    requests.send_request(platform)
    storage_content = storage.query_storage()
    text = storage_content.text
    result_set = process_response(text)
    assert "1" in result_set, "Expected 1 received %s" % result_set

    # second request
    log.info("Sending request #2")
    requests.send_request(platform)
    storage_content = storage.query_storage()
    text = storage_content.text
    result_set = process_response(text)
    assert "2" in result_set, "Expected 2 received %s" % result_set

    # third request
    log.info("Sending request #3")
    requests.send_request(platform)
    storage_content = storage.query_storage()
    text = storage_content.text
    result_set = process_response(text)
    assert "3" in result_set, "Expected 3 received %s" % result_set

    storage.kill_storage_mon(storage_proc)
    log.info("count test succeeded.")
    return util.EXIT_SUCCESS
Esempio n. 2
0
def bootstrap(distributed=False):
    # build the filter
    log.info("Building the filters")
    if distributed:
        filter_dir = kube_env.DISTRIBUTED_FILTER_DIR
    else:
        filter_dir = kube_env.FILTER_DIR

    result = kube_env.build_filter(filter_dir)
    assert result == util.EXIT_SUCCESS
    log.info("Refresh the filters")
    result = kube_env.refresh_filter(filter_dir)
    # sleep a little, so things initialize better
    log.info("Sleeping for 60 seconds")
    time.sleep(60)
    # first, clean the storage
    log.info("Cleaning storage")
    storage_proc = storage.init_storage_mon()
    storage.query_storage("clean")
    return storage_proc
Esempio n. 3
0
def test_connection_id(platform="MK", distributed=False):
    # generate the filter code
    result = generate_filter("connection_id.cql", [], distributed)
    assert result == util.EXIT_SUCCESS

    # bootstrap the filter
    storage_proc = bootstrap(distributed)

    # first request
    log.info("Sending request #1")
    requests.send_request(platform)
    storage_content = storage.query_storage()
    text = storage_content.text
    result_set = process_response(text)
    assert len(result_set) != 0

    storage.kill_storage_mon(storage_proc)
    log.info("connection_id test succeeded.")
    return util.EXIT_SUCCESS
Esempio n. 4
0
def test_height_avg(platform="MK", distributed=False):
    # generate the filter code
    result = generate_filter("height.cql", ["height.rs", "avg.rs"],
                             distributed)
    assert result == util.EXIT_SUCCESS

    # bootstrap the filter
    storage_proc = bootstrap(distributed)

    # first request
    log.info("Sending request #1")
    requests.send_request(platform)
    storage_content = storage.query_storage()
    text = storage_content.text
    result_set = process_response(text)
    assert "2" in result_set, "expected 2 received %s" % result_set

    storage.kill_storage_mon(storage_proc)
    log.info("height test succeeded.")
    return util.EXIT_SUCCESS
Esempio n. 5
0
def test_request_size(platform="MK", distributed=False):
    # generate the filter code
    result = generate_filter("request_size.cql", [], distributed)
    assert result == util.EXIT_SUCCESS

    # bootstrap the filter
    storage_proc = bootstrap(distributed)

    # first request
    log.info("Sending request #1")
    requests.send_request(platform)
    storage_content = storage.query_storage()
    text = storage_content.text
    result_set = process_response(text)
    assert "productpage-v1" in result_set, (
        "Expected productpage-v1 received %s" % result_set)

    storage.kill_storage_mon(storage_proc)
    log.info("request_size test succeeded.")
    return util.EXIT_SUCCESS
Esempio n. 6
0
def test_request_time(platform="MK", distributed=False):
    # generate the filter code
    result = generate_filter("request_time.cql", [], distributed)
    assert result == util.EXIT_SUCCESS

    # bootstrap the filter
    storage_proc = bootstrap(distributed)

    # first request
    send_time = time.time_ns()
    log.info("Sending request #1")
    requests.send_request(platform)
    storage_content = storage.query_storage()
    text = storage_content.text
    result_set = process_response(text)
    assert len(result_set) == 1
    for result in result_set:
        assert int(result) > send_time
        assert int(result) < time.time_ns()
    storage.kill_storage_mon(storage_proc)
    log.info("request_time test succeeded.")
    return util.EXIT_SUCCESS