# other attrs
    attr_name_base = 'foo-%s' % random_part
    attr_value_base = 'bar-%s' % random_part

    config_dir, output_dir = testlib.test_setup()
    volume_name = testlib.add_test_volume( config_dir )

    gateway_name = testlib.add_test_gateway( config_dir, volume_name, "UG", caps="ALL", email=testconf.SYNDICATE_ADMIN )
    getxattr_gateway_name = testlib.add_test_gateway( config_dir, volume_name, "UG", caps="ALL", port=31113, email=testconf.SYNDICATE_ADMIN )

    rg_gateway_name = testlib.add_test_gateway( config_dir, volume_name, "RG", caps="NONE", email=testconf.SYNDICATE_ADMIN )
    testlib.update_gateway( config_dir, rg_gateway_name, "port=31112", "driver=%s" % RG_DRIVER )

    # start the RG 
    rg_proc, rg_out_path = testlib.start_gateway( config_dir, RG_PATH, testconf.SYNDICATE_ADMIN, volume_name, rg_gateway_name )
    if not testlib.gateway_ping( 31112, 15 ):
        stop_and_save( output_dir, rg_proc, rg_out_path, "syndicate-rg")
        raise Exception("%s exited %s" % (RG_PATH, rg_proc.poll()))

    # put the file...
    exitcode, out = testlib.run( PUT_PATH, '-d2', '-f', '-c', os.path.join(config_dir, 'syndicate.conf'),
                                '-u', testconf.SYNDICATE_ADMIN, '-v', volume_name, '-g', gateway_name,
                                random_file_path, path )

    testlib.save_output( output_dir, "syndicate-put", out )

    if exitcode != 0:
        stop_and_save( output_dir, rg_proc, rg_out_path, "syndicate-rg")
        raise Exception("Failed to touch %s" % path)
Exemplo n.º 2
0
    local_paths = []
    for i in xrange(0, 1):
        local_path = testlib.make_random_file(16384, dir=inner_dir)
        local_paths.append(local_path)

    # start AG
    AG_gateway_name = testlib.add_test_gateway(config_dir,
                                               volume_name,
                                               "AG",
                                               caps="ALL",
                                               email=testconf.SYNDICATE_ADMIN)
    testlib.update_gateway(config_dir, AG_gateway_name, "port=31112",
                           "driver=%s" % AG_DRIVER)
    ag_proc, ag_out_path = testlib.start_gateway(config_dir,
                                                 AG_PATH,
                                                 testconf.SYNDICATE_ADMIN,
                                                 volume_name,
                                                 AG_gateway_name,
                                                 valgrind=True)
    time.sleep(30)

    if not testlib.gateway_ping(31112, 15):
        ag_exitcode, ag_out = testlib.stop_gateway(ag_proc, ag_out_path)
        testlib.save_output(output_dir, "syndicate-ag", ag_out)
        raise Exception("%s exited %s" % (AG_PATH, ag_proc.poll()))

    # should cause the AG to get updated that there's a new gateway
    ug_gateway_name = testlib.add_test_gateway(config_dir,
                                               volume_name,
                                               "UG",
                                               caps="ALL",
                                               email=testconf.SYNDICATE_ADMIN)
    if os.path.exists(testdir):
        shutil.rmtree(testdir)

    os.makedirs(testdir)
    
    local_path = testlib.make_random_file(16384, dir=testdir)
    output_path = "/%s" % os.path.basename(local_path)
    local_fd = open(local_path, "r")
    expected_data = local_fd.read()
    local_fd.close()

    # start up AG
    AG_gateway_name = testlib.add_test_gateway( config_dir, volume_name, "AG", caps="ALL", email=testconf.SYNDICATE_ADMIN )
    testlib.update_gateway( config_dir, AG_gateway_name, "driver=%s" % AG_DRIVER )

    ag_proc, ag_out_path = testlib.start_gateway( config_dir, AG_PATH, testconf.SYNDICATE_ADMIN, volume_name, AG_gateway_name, valgrind=True )
    time.sleep(30)

    if not testlib.gateway_ping( 31111, 15 ):
        raise Exception("%s exited %s" % (AG_PATH, ag_proc.poll()))

    # create separate threads for UGs 
    for i in xrange(0, num_threads):
        t = UGThread( config_dir, output_dir, output_path, volume_name, caps="ALL", port=(31111 + i + 1), email=testconf.SYNDICATE_ADMIN )
        threads.append(t)

    # run all threads 
    for i in xrange(0, num_threads):
        threads[i].start()

    # wait for them to finish 
Exemplo n.º 4
0
if __name__ == "__main__":

    config_dir, output_dir = testlib.test_setup()
    volume_name = testlib.add_test_volume(config_dir)

    RG_gateway_name = testlib.add_test_gateway(config_dir,
                                               volume_name,
                                               "RG",
                                               caps="NONE",
                                               email=testconf.SYNDICATE_ADMIN)
    testlib.update_gateway(config_dir, RG_gateway_name, "port=31112",
                           "driver=%s" % RG_DRIVER)

    rg_proc, rg_out_path = testlib.start_gateway(config_dir, RG_PATH,
                                                 testconf.SYNDICATE_ADMIN,
                                                 volume_name, RG_gateway_name)
    if not testlib.gateway_ping(31112, 15):
        raise Exception("%s exited %s" % (RG_PATH, rg_proc.poll()))

    # should cause the RG to get updated that there's a new gateway
    gateway_name = testlib.add_test_gateway(config_dir,
                                            volume_name,
                                            "UG",
                                            caps="ALL",
                                            email=testconf.SYNDICATE_ADMIN)

    # touch $NUM_FILES files
    random_part = hex(random.randint(0, 2**32 - 1))[2:]
    expected_paths = []

if __name__ == "__main__":

    local_path = testlib.make_random_file(16384)
    expected_data = None
    with open(local_path, "r") as f:
        expected_data = f.read()

    config_dir, output_dir = testlib.test_setup()
    volume_name = testlib.add_test_volume( config_dir, blocksize=1024 )

    RG_gateway_name = testlib.add_test_gateway( config_dir, volume_name, "RG", caps="NONE", email=testconf.SYNDICATE_ADMIN )
    testlib.update_gateway( config_dir, RG_gateway_name, "port=31112", "driver=%s" % RG_DRIVER )

    rg_proc, rg_out_path = testlib.start_gateway( config_dir, RG_PATH, testconf.SYNDICATE_ADMIN, volume_name, RG_gateway_name )
    if not testlib.gateway_ping( 31112, 15 ):
        raise Exception("%s exited %s" % (RG_PATH, rg_proc.poll()))

    # should cause the RG to get updated that there's a new gateway 
    gateway_name = testlib.add_test_gateway( config_dir, volume_name, "UG", caps="ALL", email=testconf.SYNDICATE_ADMIN )
    read_gateway_name = testlib.add_test_gateway( config_dir, volume_name, "UG", caps="ALL", email=testconf.SYNDICATE_ADMIN )

    read_gateway_info = testlib.read_gateway( config_dir, read_gateway_name )
    read_gateway_id = read_gateway_info['g_id']

    volume_info = testlib.read_volume( config_dir, volume_name )
    volume_id = volume_info['volume_id']

    random_part = hex(random.randint(0, 2**32-1))[2:]
    output_path = "/put-%s" % random_part
    local_fd.close()

    config_dir, output_dir = testlib.test_setup()
    volume_name = testlib.add_test_volume(config_dir, blocksize=1024)

    RG_gateway_name = testlib.add_test_gateway(config_dir,
                                               volume_name,
                                               "RG",
                                               caps="NONE",
                                               email=testconf.SYNDICATE_ADMIN)
    testlib.update_gateway(config_dir, RG_gateway_name, "port=31112",
                           "driver=%s" % RG_DRIVER)

    rg_proc, rg_out_path = testlib.start_gateway(config_dir,
                                                 RG_PATH,
                                                 testconf.SYNDICATE_ADMIN,
                                                 volume_name,
                                                 RG_gateway_name,
                                                 valgrind=True)
    if not testlib.gateway_ping(31112, 15):
        raise Exception("%s exited %s" % (RG_PATH, rg_proc.poll()))

    # should cause the RG to get updated that there's a new gateway
    gateway_name = testlib.add_test_gateway(config_dir,
                                            volume_name,
                                            "UG",
                                            caps="ALL",
                                            email=testconf.SYNDICATE_ADMIN)
    cat_gateway_name = testlib.add_test_gateway(config_dir,
                                                volume_name,
                                                "UG",
                                                caps="ALL",
Exemplo n.º 7
0
                                      attr_value_base + "-5attr-3",
                                      attr_name_base + "-5attr-4",
                                      attr_value_base + "-5attr-4",
                                      attr_name_base + "-5attr-5",
                                      attr_value_base + "-5attr-5",
                                      valgrind=True)

    testlib.save_output(output_dir, "syndicate-setxattr-5attr", out_5attr)
    if exitcode != 0:
        raise Exception("%s exited %s" % (SETXATTR_PATH, exitcode))

    # start up xattr coordinator,
    coord_proc, coord_out_path = testlib.start_gateway(
        config_dir,
        COORD_PATH,
        testconf.SYNDICATE_ADMIN,
        volume_name,
        gateway_name,
        path,
        valgrind=True)
    if not testlib.gateway_ping(31111, 15):
        raise Exception("%s exited %s" % (COORD_PATH, coord_proc.poll()))

    # remove 1 xattr, from the client
    exitcode, out_remove1xattr = testlib.run(REMOVEXATTR_PATH,
                                             '-d2',
                                             '-f',
                                             '-c',
                                             os.path.join(
                                                 config_dir, "syndicate.conf"),
                                             '-u',
                                             testconf.SYNDICATE_ADMIN,
    local_fd = open(local_path, "r")
    write_data = local_fd.read()
    local_fd.close()
    
    local_path_2 = testlib.make_random_file(16384)
    local_fd_2 = open(local_path_2, "r")
    write_data_2 = local_fd_2.read()
    local_fd_2.close()

    config_dir, output_dir = testlib.test_setup()
    volume_name = testlib.add_test_volume( config_dir, blocksize=1024 )

    RG_gateway_name = testlib.add_test_gateway( config_dir, volume_name, "RG", caps="NONE", email=testconf.SYNDICATE_ADMIN )
    testlib.update_gateway( config_dir, RG_gateway_name, "port=31112", "driver=%s" % RG_DRIVER )

    rg_proc, rg_out_path = testlib.start_gateway( config_dir, RG_PATH, testconf.SYNDICATE_ADMIN, volume_name, RG_gateway_name, valgrind=True )
    if not testlib.gateway_ping(31112, 15):
        raise Exception("%s exited %s" % (RG_PATH, rg_proc.poll()))

    # should cause the RG to get updated that there's a new gateway 
    gateway_name = testlib.add_test_gateway( config_dir, volume_name, "UG", caps="ALL", email=testconf.SYNDICATE_ADMIN )
    cat_gateway_name = testlib.add_test_gateway( config_dir, volume_name, "UG", caps="ALL", email=testconf.SYNDICATE_ADMIN )

    # look up reader gateway
    cat_gateway_info = testlib.read_gateway( config_dir, cat_gateway_name )
    cat_gateway_id = cat_gateway_info['g_id']

    # look up RG 
    rg_gateway_info = testlib.read_gateway( config_dir, RG_gateway_name )
    rg_gateway_id = rg_gateway_info['g_id']