Beispiel #1
0
def test_03_cql(request, docker_scylla, prom_address):
    loader_set = LocalLoaderSetDummy()

    cmd = 'bin/ycsb load cassandra-cql -P workloads/workloada -threads 5 -p recordcount=1000000 ' \
          '-p fieldcount=10 -p fieldlength=1024 -p operationcount=200200300 -s'
    ycsb_thread = YcsbStressThread(loader_set,
                                   cmd,
                                   node_list=[docker_scylla],
                                   timeout=5,
                                   params=TEST_PARAMS)

    def cleanup_thread():
        ycsb_thread.kill()

    request.addfinalizer(cleanup_thread)

    ycsb_thread.run()

    @timeout(timeout=60)
    def check_metrics():
        output = requests.get("http://{}/metrics".format(prom_address)).text
        regex = re.compile(r'^collectd_ycsb_read_gauge.*?([0-9\.]*?)$',
                           re.MULTILINE)
        assert 'collectd_ycsb_read_gauge' in output
        assert 'collectd_ycsb_update_gauge' in output

        matches = regex.findall(output)
        assert all(float(i) > 0 for i in matches), output

    check_metrics()
    ycsb_thread.get_results()
Beispiel #2
0
def test_03_dynamodb_api(request, docker_scylla, events):
    """
    this test isn't working yet, since we didn't figured out a way to use ndbench with dynamodb
    """
    critical_log_content_before = events.get_event_log_file('critical.log')

    # start a command that would yield errors
    loader_set = LocalLoaderSetDummy()
    cmd = f'ndbench cli.clientName=DynamoDBKeyValue ; numKeys=20000000 ; ' \
          f'numReaders=8; numWriters=8 ; readRateLimit=7200 ; writeRateLimit=1800; ' \
          f'dynamodb.autoscaling=false; dynamodb.endpoint=http://{docker_scylla.internal_ip_address}:8000'
    ndbench_thread = NdBenchStressThread(loader_set,
                                         cmd,
                                         node_list=[docker_scylla],
                                         timeout=20)

    def cleanup_thread():
        ndbench_thread.kill()

    request.addfinalizer(cleanup_thread)

    ndbench_thread.run()
    ndbench_thread.get_results()

    # check that events with the errors were sent out
    critical_log_content_after = events.wait_for_event_log_change(
        'critical.log', critical_log_content_before)

    assert 'Encountered an exception when driving load' in critical_log_content_after
    assert 'BUILD FAILED' in critical_log_content_after
def test_04_verify_data(request, docker_scylla, events):
    loader_set = LocalLoaderSetDummy()
    cmd = 'ndbench cli.clientName=CassJavaDriverGeneric ; numKeys=30 ; readEnabled=false; numReaders=0; numWriters=1 ; cass.writeConsistencyLevel=QUORUM ; cass.readConsistencyLevel=QUORUM ; generateChecksum=false'
    ndbench_thread = NdBenchStressThread(loader_set,
                                         cmd,
                                         node_list=[docker_scylla],
                                         timeout=30)

    def cleanup_thread():
        ndbench_thread.kill()

    request.addfinalizer(cleanup_thread)

    ndbench_thread.run()
    ndbench_thread.get_results()

    cmd = 'ndbench cli.clientName=CassJavaDriverGeneric ; numKeys=30 ; writeEnabled=false; numReaders=1; numWriters=0 ; cass.writeConsistencyLevel=QUORUM ; cass.readConsistencyLevel=QUORUM ; validateChecksum=true ;'
    ndbench_thread2 = NdBenchStressThread(loader_set,
                                          cmd,
                                          node_list=[docker_scylla],
                                          timeout=30)

    def cleanup_thread2():
        ndbench_thread2.kill()

    request.addfinalizer(cleanup_thread2)

    critical_log_content_before = events.get_event_log_file('critical.log')
    ndbench_thread2.run()

    time.sleep(15)
    critical_log_content_after = events.wait_for_event_log_change(
        'critical.log', critical_log_content_before)
    assert 'Failed to process NdBench read operation' in critical_log_content_after
def test_02_dynamodb_api_dataintegrity(request, docker_scylla, prom_address,
                                       events):
    loader_set = LocalLoaderSetDummy()

    # 2. do write without dataintegrity=true
    cmd = 'bin/ycsb load dynamodb -P workloads/workloada -threads 5 ' \
          '-p recordcount=50 -p fieldcount=1 -p fieldlength=100'
    ycsb_thread1 = YcsbStressThread(loader_set,
                                    cmd,
                                    node_list=[docker_scylla],
                                    timeout=30,
                                    params=TEST_PARAMS)

    def cleanup_thread1():
        ycsb_thread1.kill()

    request.addfinalizer(cleanup_thread1)

    ycsb_thread1.run()
    ycsb_thread1.get_results()
    ycsb_thread1.kill()

    # 3. do read with dataintegrity=true
    cmd = 'bin/ycsb run dynamodb -P workloads/workloada -threads 5 -p recordcount=100 ' \
          '-p fieldcount=10 -p fieldlength=512 -p dataintegrity=true -p operationcount=30000'
    ycsb_thread2 = YcsbStressThread(loader_set,
                                    cmd,
                                    node_list=[docker_scylla],
                                    timeout=30,
                                    params=TEST_PARAMS)

    def cleanup_thread2():
        ycsb_thread2.kill()

    request.addfinalizer(cleanup_thread2)

    # 4. wait for expected metrics to be available
    @timeout(timeout=120)
    def check_metrics():
        output = requests.get("http://{}/metrics".format(prom_address)).text
        regex = re.compile(r'^collectd_ycsb_verify_gauge.*?([0-9\.]*?)$',
                           re.MULTILINE)

        assert 'collectd_ycsb_verify_gauge' in output
        assert 'type="UNEXPECTED_STATE"' in output
        assert 'type="ERROR"' in output
        matches = regex.findall(output)
        assert all(float(i) >= 0 for i in matches), output

    file_logger = events.get_events_logger()
    with events.wait_for_n_events(file_logger, count=3, timeout=60):
        ycsb_thread2.run()
        check_metrics()
        ycsb_thread2.get_results()

    # 5. check that events with the expected error were raised
    cat = file_logger.get_events_by_category()
    assert len(cat['ERROR']) == 2
    assert '=UNEXPECTED_STATE' in cat['ERROR'][0]
    assert '=ERROR' in cat['ERROR'][1]
def test_01_kcl_with_ycsb(request, docker_scylla, events):  # pylint: disable=too-many-locals
    loader_set = LocalLoaderSetDummy()
    num_of_keys = 1000
    # 1. start kcl thread and ycsb at the same time
    ycsb_cmd = f'bin/ycsb load dynamodb  -P workloads/workloada -p recordcount={num_of_keys} -p dataintegrity=true ' \
               f'-p insertorder=uniform -p insertcount={num_of_keys} -p fieldcount=2 -p fieldlength=5'
    ycsb_thread = YcsbStressThread(loader_set, ycsb_cmd, node_list=[docker_scylla], timeout=600, params=TEST_PARAMS)

    kcl_cmd = f"hydra-kcl -t usertable -k {num_of_keys}"
    kcl_thread = KclStressThread(loader_set, kcl_cmd, node_list=[docker_scylla], timeout=600, params=TEST_PARAMS)
    stress_cmd = 'table_compare interval=20; src_table="alternator_usertable".usertable; ' \
                 'dst_table="alternator_usertable-dest"."usertable-dest"'
    compare_sizes = CompareTablesSizesThread(
        loader_set=loader_set, stress_cmd=stress_cmd, node_list=[docker_scylla], timeout=600, params=TEST_PARAMS)

    def cleanup_thread():
        ycsb_thread.kill()
        kcl_thread.kill()

    request.addfinalizer(cleanup_thread)

    time.sleep(60)
    kcl_thread.run()
    time.sleep(30)
    ycsb_thread.run()

    compare_sizes.run()
    compare_sizes.get_results()

    output = ycsb_thread.get_results()
    assert 'latency mean' in output[0]
    assert float(output[0]['latency mean']) > 0

    assert 'latency 99th percentile' in output[0]
    assert float(output[0]['latency 99th percentile']) > 0

    output = kcl_thread.get_results()
    logging.debug(output)

    error_log_content_before = events.get_event_log_file('error.log')

    # 2. do read with dataintegrity=true
    cmd = f'bin/ycsb run dynamodb -P workloads/workloada -p recordcount={num_of_keys} -p insertorder=uniform ' \
          f'-p insertcount={num_of_keys} -p fieldcount=2 -p fieldlength=5 -p dataintegrity=true ' \
          f'-p operationcount={num_of_keys}'
    ycsb_thread2 = YcsbStressThread(loader_set, cmd, node_list=[docker_scylla], timeout=500, params=TEST_PARAMS)

    def cleanup_thread2():
        ycsb_thread2.kill()

    request.addfinalizer(cleanup_thread2)

    ycsb_thread2.run()
    ycsb_thread2.get_results()

    # 3. check that events with errors weren't raised
    error_log_content_after = events.get_event_log_file('error.log')
    assert error_log_content_after == error_log_content_before
def test_02_dynamodb_api_dataintegrity(request, docker_scylla, prom_address,
                                       events):
    loader_set = LocalLoaderSetDummy()

    error_log_content_before = events.get_event_log_file('error.log')

    # 2. do write without dataintegrity=true
    cmd = 'bin/ycsb load dynamodb -P workloads/workloada -threads 5 -p recordcount=10000 -p fieldcount=10 -p fieldlength=512'
    ycsb_thread1 = YcsbStressThread(loader_set,
                                    cmd,
                                    node_list=[docker_scylla],
                                    timeout=5,
                                    params=TEST_PARAMS)

    def cleanup_thread1():
        ycsb_thread1.kill()

    request.addfinalizer(cleanup_thread1)

    ycsb_thread1.run()
    ycsb_thread1.get_results()
    ycsb_thread1.kill()

    # 3. do read with dataintegrity=true
    cmd = 'bin/ycsb run dynamodb -P workloads/workloada -threads 5 -p recordcount=10000 -p fieldcount=10 -p fieldlength=512 -p dataintegrity=true -p hdrhistogram.summary.addstatus=true -p operationcount=100000000'
    ycsb_thread2 = YcsbStressThread(loader_set,
                                    cmd,
                                    node_list=[docker_scylla],
                                    timeout=20,
                                    params=TEST_PARAMS)

    def cleanup_thread2():
        ycsb_thread2.kill()

    request.addfinalizer(cleanup_thread2)

    ycsb_thread2.run()

    # 4. wait for expected metrics to be available
    @timeout(timeout=60)
    def check_metrics():
        output = requests.get("http://{}/metrics".format(prom_address)).text
        regex = re.compile(r'^collectd_ycsb_verify_gauge.*?([0-9\.]*?)$',
                           re.MULTILINE)

        assert 'collectd_ycsb_verify_gauge' in output
        assert 'UNEXPECTED_STATE' in output
        matches = regex.findall(output)
        assert all(float(i) >= 0 for i in matches), output

    check_metrics()
    ycsb_thread2.get_results()

    # 5. check that events with the expected error were raised
    error_log_content_after = events.wait_for_event_log_change(
        'error.log', error_log_content_before)
    assert 'UNEXPECTED_STATE' in error_log_content_after
def test_01_cql_api(request, docker_scylla):
    loader_set = LocalLoaderSetDummy()
    cmd = 'ndbench cli.clientName=CassJavaDriverGeneric ; numKeys=20000000 ; numReaders=8; numWriters=8 ; cass.writeConsistencyLevel=QUORUM ; cass.readConsistencyLevel=QUORUM ; readRateLimit=7200 ; writeRateLimit=1800'
    ndbench_thread = NdBenchStressThread(loader_set,
                                         cmd,
                                         node_list=[docker_scylla],
                                         timeout=5)

    def cleanup_thread():
        ndbench_thread.kill()

    request.addfinalizer(cleanup_thread)
    ndbench_thread.run()
    ndbench_thread.get_results()
Beispiel #8
0
def test_02_cql_kill(request, docker_scylla):
    """
    verifies that kill command on the NdBenchStressThread is working
    """
    loader_set = LocalLoaderSetDummy()
    cmd = 'ndbench cli.clientName=CassJavaDriverGeneric ; numKeys=20000000 ; ' \
          'numReaders=8; numWriters=8 ; cass.writeConsistencyLevel=QUORUM ; ' \
          'cass.readConsistencyLevel=QUORUM ; readRateLimit=7200 ; writeRateLimit=1800'
    ndbench_thread = NdBenchStressThread(loader_set,
                                         cmd,
                                         node_list=[docker_scylla],
                                         timeout=500)

    def cleanup_thread():
        ndbench_thread.kill()

    request.addfinalizer(cleanup_thread)
    ndbench_thread.run()
    time.sleep(3)
    ndbench_thread.kill()
    ndbench_thread.get_results()