Пример #1
0
 def setup_class(cls):
     logdir = make_logdir(ENV_UP_LOGDIR, get_file_name(__file__))
     result = run_env_up_script("env_up.py",
                                config=config_file('env.json'),
                                logdir=logdir,
                                skip=False)
     cls.result = result
Пример #2
0
def persistent_environment(request, env_description_abs_path):
    """
    Sets up environment and returns environment description.
    """
    logdir_path = map_test_type_to_logdir(get_test_type(request))
    feature_name = request.module.__name__.split('.')[-1]

    logdir = make_logdir(
        logdir_path,
        os.path.join(get_file_name(env_description_abs_path), feature_name))
    env_desc = run_env_up_script("env_up.py",
                                 config=env_description_abs_path,
                                 logdir=logdir,
                                 skip=False)

    # Make sure OP instances are connected to their zones before the test starts.
    print('Waiting for OZ connectivity of providers...')
    for op_node in env_desc['op_worker_nodes']:
        host = op_node.split("@")[1]
        ip = docker_ip(host)
        if not ensure_provider_oz_connectivity(ip):
            raise Exception(
                'Could not ensure OZ connectivity of provider {0}'.format(
                    host))
    print('OZ connectivity established')

    def fin():
        docker.remove(request.onedata_environment['docker_ids'],
                      force=True,
                      volumes=True)
        remove_symlinks(logdir)

    request.addfinalizer(fin)
    request.onedata_environment = env_desc
    return env_desc
 def setup_class(cls):
     logdir = make_logdir(ENV_UP_LOGDIR, get_file_name(__file__))
     cls.result = appmock.up(image='onedata/builder',
                             bindir=APPMOCK_DIR,
                             dns_server='none',
                             uid=common.generate_uid(),
                             config_path=os.path.join(config_file('env.json')),
                             logdir=logdir)
Пример #4
0
def skip_by_env(request, env_description_file):
    """This function skips test cases decorated with:
    @pytest.mark.skip_env(*envs).
    Test won't start for each env in envs.
    If you want to skip whole module, you must define
    global variable in that module named pytestmark in
    the following way:
    pytestmark = pytest.mark.skip_env(*envs)
    """
    if request.node.get_marker('skip_env'):
        env = get_file_name(env_description_file)
        args = request.node.get_marker('skip_env').kwargs
        reason = args['reason']
        arg_envs = [get_file_name(e) for e in args['envs']]
        if env in arg_envs:
            pytest.skip('skipped on env: {env} with reason: {reason}'.format(
                env=env, reason=reason))
Пример #5
0
def skip_by_env(request, env_description_file):
    """This function skips test cases decorated with:
    @pytest.mark.skip_env(*envs).
    Test won't start for each env in envs.
    If you want to skip whole module, you must define
    global variable in that module named pytestmark in
    the following way:
    pytestmark = pytest.mark.skip_env(*envs)
    """
    if request.node.get_marker('skip_env'):
        env = get_file_name(env_description_file)
        args = request.node.get_marker('skip_env').kwargs
        reason = args['reason']
        arg_envs = [get_file_name(e) for e in args['envs']]
        if env in arg_envs:
            pytest.skip('skipped on env: {env} with reason: {reason}'
                        .format(env=env, reason=reason))
Пример #6
0
    def suite_report(self, request, env_report):
        module = inspect.getmodule(self.__class__)
        name = get_file_name(inspect.getfile(self.__class__))
        report = SuiteReport(name, get_suite_description(module),
                             get_copyright(module), get_authors(module))

        def fin():
            env_report.add_to_report("suites", report)

        request.addfinalizer(fin)
        return report
Пример #7
0
def xfail_by_env(request, env_description_file):
    """This function marks test cases decorated with:
    @pytest.mark.skip_env(*envs)
    as expected to fail:
    Test will be marked as expected to fail for each
    env in envs.
    If you want to mark whole module, you must define
    global variable in that module named pytestmark in
    the following way:
    pytestmark = pytest.mark.xfail_env(*envs)
    Running tests with --ignore-xfail causes xfail marks to be ignored.
    """
    if request.node.get_marker('xfail_env'):
        env = get_file_name(env_description_file)
        args = request.node.get_marker('xfail_env').kwargs
        reason = args['reason']
        arg_envs = [get_file_name(e) for e in args['envs']]
        ignore = request.config.getoption("--ignore-xfail")
        if env in arg_envs and not ignore:
            request.node.add_marker(pytest.mark.xfail(
                reason='xfailed on env: {env} with reason: {reason}'
                    .format(env=env, reason=reason)))
Пример #8
0
def xfail_by_env(request, env_description_file):
    """This function marks test cases decorated with:
    @pytest.mark.skip_env(*envs)
    as expected to fail:
    Test will be marked as expected to fail for each
    env in envs.
    If you want to mark whole module, you must define
    global variable in that module named pytestmark in
    the following way:
    pytestmark = pytest.mark.xfail_env(*envs)
    Running tests with --ignore-xfail causes xfail marks to be ignored.
    """
    if request.node.get_marker('xfail_env'):
        env = get_file_name(env_description_file)
        args = request.node.get_marker('xfail_env').kwargs
        reason = args['reason']
        arg_envs = [get_file_name(e) for e in args['envs']]
        ignore = request.config.getoption("--ignore-xfail")
        if env in arg_envs and not ignore:
            request.node.add_marker(
                pytest.mark.xfail(
                    reason='xfailed on env: {env} with reason: {reason}'.
                    format(env=env, reason=reason)))
Пример #9
0
def persistent_environment(request, env_description_abs_path):
    """
    Sets up environment and returns environment description.
    """
    logdir_path = map_test_type_to_logdir(get_test_type(request))
    feature_name = request.module.__name__.split('.')[-1]

    logdir = make_logdir(logdir_path, os.path
                         .join(get_file_name(env_description_abs_path),
                               feature_name))
    env_desc = run_env_up_script("env_up.py", config=env_description_abs_path,
                                 logdir=logdir, skip=False)

    def fin():
        docker.remove(request.onedata_environment['docker_ids'],
                      force=True,
                      volumes=True)

    request.addfinalizer(fin)
    request.onedata_environment = env_desc
    return env_desc
Пример #10
0
def persistent_environment(request, env_description_abs_path):
    """
    Sets up environment and returns environment description.
    """
    logdir_path = map_test_type_to_logdir(get_test_type(request))
    feature_name = request.module.__name__.split('.')[-1]

    logdir = make_logdir(
        logdir_path,
        os.path.join(get_file_name(env_description_abs_path), feature_name))
    env_desc = run_env_up_script("env_up.py",
                                 config=env_description_abs_path,
                                 logdir=logdir,
                                 skip=False)

    def fin():
        docker.remove(request.onedata_environment['docker_ids'],
                      force=True,
                      volumes=True)

    request.addfinalizer(fin)
    request.onedata_environment = env_desc
    return env_desc
Пример #11
0
 def setup_class(cls):
     logdir = make_logdir(ENV_UP_LOGDIR, get_file_name(__file__))
     result = run_env_up_script("env_up.py",
                                config=config_file('env.json'),
                                logdir=logdir, skip=False)
     cls.result = result