Ejemplo n.º 1
0
def tearDownModule():
    global testrun_search_bucket, testrun_props_bucket, \
        testrun_sibs_bucket, testrun_yz_bucket

    c = RiakClient(protocol='http', host=HTTP_HOST, http_port=HTTP_PORT,
                   pb_port=PB_PORT, credentials=SECURITY_CREDS)

    c.bucket(testrun_sibs_bucket).clear_properties()
    c.bucket(testrun_props_bucket).clear_properties()

    if not SKIP_SEARCH and not RUN_YZ:
        b = c.bucket(testrun_search_bucket)
        b.clear_properties()

    if RUN_YZ:
        c.protocol = 'pbc'
        yzbucket = c.bucket(testrun_yz_bucket)
        yzbucket.set_property('search_index', '_dont_index_')
        c.delete_search_index(testrun_yz_bucket)
        for keys in yzbucket.stream_keys():
            for key in keys:
                yzbucket.delete(key)
        mrtype = c.bucket_type(testrun_mr_btype)
        mrbucket = mrtype.bucket(testrun_mr_bucket)
        mrbucket.set_property('search_index', '_dont_index_')
        c.delete_search_index(testrun_mr_bucket)
        for keys in mrbucket.stream_keys():
            for key in keys:
                mrbucket.delete(key)
def setUpModule():
    global testrun_search_bucket, testrun_props_bucket, \
        testrun_sibs_bucket, testrun_yz_bucket

    c = RiakClient(protocol='http', host=HTTP_HOST, http_port=HTTP_PORT,
                   pb_port=PB_PORT)

    testrun_props_bucket = 'propsbucket'
    testrun_sibs_bucket = 'sibsbucket'
    c.bucket(testrun_sibs_bucket).allow_mult = True

    if (not SKIP_SEARCH and not RUN_YZ):
        testrun_search_bucket = 'searchbucket'
        b = c.bucket(testrun_search_bucket)
        b.enable_search()

    if RUN_YZ:
        c.protocol = 'pbc'
        testrun_yz_bucket = 'yzbucket'
        c.create_search_index(testrun_yz_bucket)
        b = c.bucket(testrun_yz_bucket)
        index_set = False
        while not index_set:
            try:
                b.set_property('search_index', testrun_yz_bucket)
                index_set = True
            except RiakError:
                pass
Ejemplo n.º 3
0
def setUpModule():
    global testrun_search_bucket, testrun_props_bucket, \
        testrun_sibs_bucket, testrun_yz_bucket, testrun_mr_btype, \
        testrun_mr_bucket

    c = RiakClient(protocol='pbc', host=PB_HOST, http_port=HTTP_PORT,
                   pb_port=PB_PORT, credentials=SECURITY_CREDS)

    testrun_props_bucket = 'propsbucket'
    testrun_sibs_bucket = 'sibsbucket'
    c.bucket(testrun_sibs_bucket).allow_mult = True

    if (not SKIP_SEARCH and not RUN_YZ):
        testrun_search_bucket = 'searchbucket'
        b = c.bucket(testrun_search_bucket)
        b.enable_search()

    if RUN_YZ:
        c.protocol = 'pbc'
        testrun_yz_bucket = 'yzbucket'
        c.create_search_index(testrun_yz_bucket)
        b = c.bucket(testrun_yz_bucket)
        index_set = False
        while not index_set:
            try:
                b.set_property('search_index', testrun_yz_bucket)
                index_set = True
            except RiakError:
                pass
        # Add bucket and type for Search -> MapReduce
        testrun_mr_btype = 'pytest-mr'
        testrun_mr_bucket = 'mrbucket'
        c.create_search_index(testrun_mr_bucket, '_yz_default')
        t = c.bucket_type(testrun_mr_btype)
        b = t.bucket(testrun_mr_bucket)
        index_set = False
        while not index_set:
            try:
                b.set_property('search_index', testrun_mr_bucket)
                index_set = True
            except RiakError:
                pass