예제 #1
0
from __future__ import absolute_import
from __future__ import division

import errno
import io
import mmap
import os
import stat

from contextlib import closing

import pytest

import userstorage

BACKENDS = userstorage.load_config("example_config.py").BACKENDS


@pytest.fixture(
    params=[
        BACKENDS["block-512"],
        BACKENDS["block-4k"],
    ],
    ids=str,
)
def user_loop(request):
    backend = validate_backend(request.param)
    backend.setup()
    yield backend
    backend.teardown()
예제 #2
0
from ovirt_imageio import nbd
from ovirt_imageio import nbdutil
from ovirt_imageio import qemu_img
from ovirt_imageio import qemu_nbd

from . import backup
from . import distro
from . import storage
from . import testutil

from .marks import requires_advanced_virt, requires_python3

pytestmark = requires_python3

BACKENDS = userstorage.load_config("../storage.py").BACKENDS

log = logging.getLogger("test")


@pytest.fixture(params=[
    BACKENDS["file-512-ext4"],
    BACKENDS["file-512-xfs"],
    BACKENDS["file-4k-ext4"],
    BACKENDS["file-4k-xfs"],
],
                ids=str)
def user_file(request):
    with storage.Backend(request.param) as backend:
        yield backend
예제 #3
0
# Copyright (C) 2019 Nir Soffer
# This program is free software; see LICENSE for more info.

from __future__ import absolute_import
from __future__ import division

import subprocess
import sys

import pytest

import userstorage

CONFIG = "test/provision_config.py"
BACKENDS = userstorage.load_config(CONFIG).BACKENDS


def run(command):
    subprocess.check_call(
        [sys.executable, "-m", "userstorage", command, CONFIG])


@pytest.fixture
def cleanup():
    yield
    run("delete")


@pytest.mark.sudo
def test_provision(cleanup):
    run("create")