"user.syndicate_write_ttl"
    ]
    builtin_xattr_expected_values = {
        "user.syndicate_coordinator": None,
        "user.syndicate_cached_blocks": "0000", # for the getxattr gateway
        "user.syndicate_cached_file_path": None,
        "user.syndicate_read_ttl": "5000",
        "user.syndicate_write_ttl": "0"
    }

    # 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'),
        return

    def set_errors(self, e):
        self.errors = e

    def get_exitcode(self):
        return self.exitcode

    def get_errormsg(self):
        return self.errormsg


if __name__ == "__main__":

    config_dir, output_dir = testlib.test_setup()
    volume_name = testlib.add_test_volume( config_dir, blocksize=1024 )
    num_threads = 8
    threads = []

    # create AG source dataset.  extract config
    ag_driver = syndicate.util.objects.load_driver( AG_DRIVER, None, include_secrets=False )
    assert 'config' in ag_driver
    ag_config_txt = base64.b64decode(ag_driver['config'])
    ag_config = json.loads(ag_config_txt)

    # path to file...
    assert 'DATASET_DIR' in ag_config
    testdir = ag_config['DATASET_DIR']
    if os.path.exists(testdir):
        shutil.rmtree(testdir)
Beispiel #3
0
import testconf
import shutil

import syndicate

CAT_PATH = os.path.join(testconf.SYNDICATE_UG_ROOT, "syndicate-cat")
LS_PATH = os.path.join(testconf.SYNDICATE_UG_ROOT, "syndicate-ls")
REFRESH_PATH = os.path.join(testconf.SYNDICATE_UG_ROOT, "syndicate-refresh")
AG_PATH = os.path.join(testconf.SYNDICATE_AG_ROOT, "syndicate-ag")
AG_DRIVER = os.path.join(testconf.SYNDICATE_PYTHON_ROOT,
                         "syndicate/ag/drivers/disk")

if __name__ == "__main__":

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

    # create AG source dataset.  extract config
    ag_driver = syndicate.util.objects.load_driver(AG_DRIVER,
                                                   None,
                                                   include_secrets=False)
    assert 'config' in ag_driver
    ag_config_txt = base64.b64decode(ag_driver['config'])
    ag_config = json.loads(ag_config_txt)

    # path to file...
    assert 'DATASET_DIR' in ag_config
    testdir = ag_config['DATASET_DIR']
    if os.path.exists(testdir):
        shutil.rmtree(testdir)
def stop_and_save(output_dir, proc, out_path, save_name):
    exitcode, out = testlib.stop_gateway(proc, out_path)
    testlib.save_output(output_dir, save_name, out)
    return exitcode, out


if __name__ == "__main__":

    local_path = testlib.make_random_file(16384)
    local_fd = open(local_path, "r")
    expected_data = local_fd.read()
    local_fd.close()

    config_dir, output_dir = testlib.test_setup()
    volume_name = testlib.add_test_volume(config_dir,
                                          allow_anon=True,
                                          private=False)

    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,
NUM_FILES = 1

def stop_and_save( output_dir, proc, out_path, save_name ):
    exitcode, out = testlib.stop_gateway( proc, out_path )
    testlib.save_output( output_dir, save_name, out )
    return exitcode, out

if __name__ == "__main__":

    local_path = testlib.make_random_file(16384)
    local_fd = open(local_path, "r")
    expected_data = local_fd.read()
    local_fd.close()

    config_dir, output_dir = testlib.test_setup()
    volume_name = testlib.add_test_volume( config_dir, allow_anon=True, private=False )

    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="ANONYMOUS" )

    random_part = hex(random.randint(0, 2**32-1))[2:]
    output_paths = []
        expected_data_list[i] = c
        i += 1

    return "".join(expected_data_list)


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()))