# 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) # finish populating expected built-in xattrs
volume_name = testlib.add_test_volume( config_dir ) num_threads = 8 threads = [] local_path = testlib.make_random_file(16384) output_path = "/%s" % os.path.basename(local_path) local_fd = open(local_path, "r") expected_data = local_fd.read() local_fd.close() # start up RG RG_gateway_name = testlib.add_test_gateway( config_dir, volume_name, "RG", port=32110, email=testconf.SYNDICATE_ADMIN ) testlib.update_gateway( config_dir, RG_gateway_name, "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( 32110, 15 ): raise Exception("%s exited %s" % (RG_PATH, rg_proc.poll())) # put the file put_gateway_name = testlib.add_test_gateway( config_dir, volume_name, "UG", caps="ALL", port=31110, email=testconf.SYNDICATE_ADMIN ) exitcode, out = testlib.run( PUT_PATH, '-d2', '-f', '-c', os.path.join(config_dir, 'syndicate.conf'), '-u', testconf.SYNDICATE_ADMIN, '-v', volume_name, '-g', put_gateway_name, local_path, output_path, valgrind=True ) 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("syndicate-put exit code %s" % exitcode) # 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)
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) # remove inner dir, and have the AG refresh shutil.rmtree(rmdir) exitcode, out = testlib.run(REFRESH_PATH, '-d2',
# start up RG RG_gateway_name = testlib.add_test_gateway(config_dir, volume_name, "RG", port=32110, email=testconf.SYNDICATE_ADMIN) testlib.update_gateway(config_dir, RG_gateway_name, "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(32110, 15): raise Exception("%s exited %s" % (RG_PATH, rg_proc.poll())) # put the file put_gateway_name = testlib.add_test_gateway(config_dir, volume_name, "UG", caps="ALL", port=31110, email=testconf.SYNDICATE_ADMIN) exitcode, out = testlib.run(PUT_PATH, '-d2', '-f', '-c', os.path.join(config_dir, 'syndicate.conf'), '-u',