def setup_module(): global test_ebs test_ebs = pytest.config.getoption("ebs") global test_container test_container = pytest.config.getoption("container") if os.path.exists(TEST_ROOT): subprocess.check_call(["rm", "-rf", TEST_ROOT]) os.makedirs(TEST_ROOT) assert os.path.exists(TEST_ROOT) os.makedirs(VFS_BACKUP_DIR) assert os.path.exists(VFS_BACKUP_DIR) data_file = os.path.join(TEST_ROOT, DATA_FILE) create_empty_file(data_file, DATA_DEVICE_SIZE) global data_dev data_dev = attach_loopback_dev(data_file) metadata_file = os.path.join(TEST_ROOT, METADATA_FILE) create_empty_file(metadata_file, METADATA_DEVICE_SIZE) global metadata_dev metadata_dev = attach_loopback_dev(metadata_file) global v cmdline = [] if test_container: v = VolumeManager(CONVOY_CONTAINER_CMD, TEST_ROOT) cmdline = ["convoy-start", "--mnt-ns", "/host/proc/1/ns/mnt"] else: v = VolumeManager(CONVOY_BINARY, TEST_ROOT) cmdline = ["daemon"] cmdline += [ "--root", CFG_ROOT, "--log", LOG_FILE, "--drivers=" + DM, "--driver-opts", "dm.datadev=" + data_dev, "--driver-opts", "dm.metadatadev=" + metadata_dev, "--driver-opts", "dm.thinpoolname=" + POOL_NAME, "--driver-opts", "dm.defaultvolumesize=" + DEFAULT_VOLUME_SIZE, "--drivers=" + VFS, "--driver-opts", "vfs.path=" + VFS_VOLUME_PATH ] if test_ebs: cmdline += [ "--drivers=ebs", "--driver-opts", "ebs.defaultvolumesize=" + DEFAULT_VOLUME_SIZE, "--driver-opts", "ebs.defaultvolumetype=" + EBS_DEFAULT_VOLUME_TYPE ] if test_container: v.start_server_container(CONTAINER_NAME, CFG_ROOT, TEST_ROOT, CONTAINER, cmdline) else: v.start_server(PID_FILE, cmdline) dm_cleanup_list.append(POOL_NAME) wait_for_daemon()
def setup_module(): if os.path.exists(TEST_ROOT): subprocess.check_call(["rm", "-rf", TEST_ROOT]) os.makedirs(TEST_ROOT) assert os.path.exists(TEST_ROOT) os.makedirs(MOUNT_ROOT) assert os.path.exists(MOUNT_ROOT) data_file = os.path.join(TEST_ROOT, DATA_FILE) create_empty_file(data_file, DATA_DEVICE_SIZE) global data_dev data_dev = attach_loopback_dev(data_file) metadata_file = os.path.join(TEST_ROOT, METADATA_FILE) create_empty_file(metadata_file, METADATA_DEVICE_SIZE) global metadata_dev metadata_dev = attach_loopback_dev(metadata_file) global v v = VolumeManager(CONVOY_BINARY, TEST_ROOT) v.start_server(PID_FILE, [ "daemon", "--root", CFG_ROOT, "--log", LOG_FILE, "--drivers=" + DM, "--driver-opts", "dm.datadev=" + data_dev, "--driver-opts", "dm.metadatadev=" + metadata_dev, "--driver-opts", "dm.thinpoolname=" + POOL_NAME, "--driver-opts", "dm.defaultvolumesize=" + DEFAULT_VOLUME_SIZE, "--drivers=" + VFS, "--driver-opts", "vfs.path=" + VFS_VOLUME_PATH ]) dm_cleanup_list.append(POOL_NAME) wait_for_daemon()
def setup_module(): global test_ebs test_ebs = pytest.config.getoption("ebs") global test_container test_container = pytest.config.getoption("container") if os.path.exists(TEST_ROOT): subprocess.check_call(["rm", "-rf", TEST_ROOT]) os.makedirs(TEST_ROOT) assert os.path.exists(TEST_ROOT) os.makedirs(VFS_BACKUP_DIR) assert os.path.exists(VFS_BACKUP_DIR) data_file = os.path.join(TEST_ROOT, DATA_FILE) create_empty_file(data_file, DATA_DEVICE_SIZE) global data_dev data_dev = attach_loopback_dev(data_file) metadata_file = os.path.join(TEST_ROOT, METADATA_FILE) create_empty_file(metadata_file, METADATA_DEVICE_SIZE) global metadata_dev metadata_dev = attach_loopback_dev(metadata_file) global v container_opts = [] cmdline = [] if test_container: v = VolumeManager(CONVOY_CONTAINER_CMD, TEST_ROOT) cmdline = ["convoy-start", "--mnt-ns", "/host/proc/1/ns/mnt"] else: v = VolumeManager(CONVOY_BINARY, TEST_ROOT) cmdline = ["daemon"] cmdline += [ "--root", CFG_ROOT, "--log", LOG_FILE, "--drivers=" + DM, "--driver-opts", "dm.datadev=" + data_dev, "--driver-opts", "dm.metadatadev=" + metadata_dev, "--driver-opts", "dm.thinpoolname=" + POOL_NAME, "--driver-opts", "dm.defaultvolumesize=" + DEFAULT_VOLUME_SIZE, "--drivers=" + VFS, "--driver-opts", "vfs.path=" + VFS_VOLUME_PATH ] if test_ebs: cmdline += [ "--drivers=ebs", "--driver-opts", "ebs.defaultvolumesize=" + DEFAULT_VOLUME_SIZE, "--driver-opts", "ebs.defaultvolumetype=" + EBS_DEFAULT_VOLUME_TYPE ] global S3_AUTO_SETUP if S3_AUTO_SETUP: global s3_server, S3_BUCKET, S3_REGION, S3_ENDPOINT access_key = "convoy" secret_key = "password" s3_server = S3Server(access_key=access_key, secret_key=secret_key) s3_server.start() S3_BUCKET = "test" S3_REGION = "us-east-1" S3_ENDPOINT = s3_server.connection_str() s3_server.make_bucket(S3_BUCKET) # ensure credentials for convoy server (both container and binary) container_opts += [ "--env", "AWS_ACCESS_KEY=" + access_key, "--env", "AWS_SECRET_KEY=" + secret_key ] os.environ["AWS_ACCESS_KEY"] = access_key os.environ["AWS_SECRET_KEY"] = secret_key if test_container: v.start_server_container(CONTAINER_NAME, CFG_ROOT, TEST_ROOT, container_opts, CONTAINER_IMAGE, cmdline) else: v.start_server(PID_FILE, cmdline) dm_cleanup_list.append(POOL_NAME) wait_for_daemon()