Exemplo n.º 1
0
def test_bad_bulk_insert_event_timestamp():
    """Test what happens when one event is missing a timestamp for one key"""
    num = 50
    rs, e_desc, data_keys = setup_syn()
    all_data = syn_data(data_keys, num)
    # remove one of the keys from the event timestamps
    del all_data[1]['timestamps']['F']
    mdsc.bulk_insert_events(e_desc, all_data, validate=True)
Exemplo n.º 2
0
def test_bad_bulk_insert_event_timestamp():
    """Test what happens when one event is missing a timestamp for one key"""
    num = 50
    rs, e_desc, data_keys = setup_syn()
    all_data = syn_data(data_keys, num)
    # remove one of the keys from the event timestamps
    del all_data[1]['timestamps']['F']
    mdsc.bulk_insert_events(e_desc, all_data, validate=True)
Exemplo n.º 3
0
def test_bad_bulk_insert_event_data():
    num = 50
    rs, e_desc, data_keys = setup_syn()
    all_data = syn_data(data_keys, num)

    # remove one of the keys from the event data
    del all_data[-1]['data']['E']
    mdsc.bulk_insert_events(e_desc, all_data, validate=True)
Exemplo n.º 4
0
def test_bad_bulk_insert_event_data():
    num = 50
    rs, e_desc, data_keys = setup_syn()
    all_data = syn_data(data_keys, num)

    # remove one of the keys from the event data
    del all_data[-1]['data']['E']
    mdsc.bulk_insert_events(e_desc, all_data, validate=True)
Exemplo n.º 5
0
def test_bulk_table():
    num = 50
    rs, e_desc, data_keys = setup_syn()
    all_data = syn_data(data_keys, num)

    mdsc.bulk_insert_events(e_desc, all_data, validate=False)
    mdsc.insert_run_stop(rs, ttime.time(), uid=str(uuid.uuid4()))
    ret = mdsc.get_events_table(e_desc)
    descriptor, data_table, seq_nums, times, uids, timestamps_table = ret

    for vals in data_table.values():
        assert_true(all(s == v for s, v in zip(seq_nums, vals)))
Exemplo n.º 6
0
def test_bulk_table():
    num = 50
    rs, e_desc, data_keys = setup_syn()
    all_data = syn_data(data_keys, num)

    mdsc.bulk_insert_events(e_desc, all_data, validate=False)
    mdsc.insert_run_stop(rs, ttime.time(), uid=str(uuid.uuid4()))
    ret = mdsc.get_events_table(e_desc)
    descriptor, data_table, seq_nums, times, uids, timestamps_table = ret

    for vals in data_table.values():
        assert_true(all(s == v for s, v in zip(seq_nums, vals)))
Exemplo n.º 7
0
def test_bulk_insert():
    num = 50
    rs, e_desc, data_keys = setup_syn()
    all_data = syn_data(data_keys, num)

    mdsc.bulk_insert_events(e_desc, all_data, validate=False)
    mdsc.insert_run_stop(rs, ttime.time(), uid=str(uuid.uuid4()))

    ev_gen = mdsc.get_events_generator(e_desc)

    for ret, expt in zip(ev_gen, all_data):
        print(ret)
        assert_equal(ret['descriptor']['uid'], e_desc)
        for k in ['data', 'timestamps', 'time', 'uid', 'seq_num']:
            assert_equal(ret[k], expt[k])
Exemplo n.º 8
0
def test_bulk_insert():
    num = 50
    rs, e_desc, data_keys = setup_syn()
    all_data = syn_data(data_keys, num)

    mdsc.bulk_insert_events(e_desc, all_data, validate=False)
    mdsc.insert_run_stop(rs, ttime.time(), uid=str(uuid.uuid4()))

    ev_gen = mdsc.get_events_generator(e_desc)

    for ret, expt in zip(ev_gen, all_data):
        print(ret)
        assert_equal(ret['descriptor']['uid'], e_desc)
        for k in ['data', 'timestamps', 'time', 'uid', 'seq_num']:
            assert_equal(ret[k], expt[k])
Exemplo n.º 9
0
def test_find_events_smoke():
    num = 50
    rs, e_desc, data_keys = setup_syn()
    all_data = syn_data(data_keys, num)

    print(rs)
    print(e_desc)
    mdsc.bulk_insert_events(e_desc, all_data, validate=False)
    mdsc.insert_run_stop(rs, ttime.time(), uid=str(uuid.uuid4()))
    # mdsc.clear_process_cache()

    # make sure the uid works
    next(mdsc.find_events(descriptor=e_desc))

    # mdsc.clear_process_cache()
    descriptor, = mdsc.find_descriptors(uid=e_desc)

    # mdsc.clear_process_cache()
    # make sure that searching by descriptor document works
    next(mdsc.find_events(descriptor=descriptor))
Exemplo n.º 10
0
def test_find_events_smoke():
    num = 50
    rs, e_desc, data_keys = setup_syn()
    all_data = syn_data(data_keys, num)

    print(rs)
    print(e_desc)
    mdsc.bulk_insert_events(e_desc, all_data, validate=False)
    mdsc.insert_run_stop(rs, ttime.time(), uid=str(uuid.uuid4()))
    # mdsc.clear_process_cache()

    # make sure the uid works
    next(mdsc.find_events(descriptor=e_desc))

    # mdsc.clear_process_cache()
    descriptor, = mdsc.find_descriptors(uid=e_desc)

    # mdsc.clear_process_cache()
    # make sure that searching by descriptor document works
    next(mdsc.find_events(descriptor=descriptor))