Exemple #1
0
def setUpModule():  # pylint:disable=invalid-name
    """Conditionally skip tests. Cache packages to be uploaded to repos.

    Skip the tests in this module if:

    * The RPM plugin is unsupported.
    * `Pulp #1991 <https://pulp.plan.io/issues/1991>`_ is untestable for the
      version of Pulp under test.
    """
    cfg = config.get_config()
    if not selectors.bug_is_fixed(1991, cfg.pulp_version):
        raise unittest.SkipTest('https://pulp.plan.io/issues/1991')
    set_up_module()
    try:
        _SIGNED_PACKAGES['rpm'] = utils.http_get(RPM_SIGNED_URL)
        _SIGNED_PACKAGES['srpm'] = utils.http_get(SRPM_SIGNED_URL)
        _UNSIGNED_PACKAGES['rpm'] = utils.http_get(RPM_UNSIGNED_URL)
        _UNSIGNED_PACKAGES['srpm'] = utils.http_get(SRPM_UNSIGNED_URL)
        if selectors.bug_is_fixed(1806, cfg.pulp_version):
            _SIGNED_PACKAGES['drpm'] = utils.http_get(DRPM_SIGNED_URL)
            _UNSIGNED_PACKAGES['drpm'] = utils.http_get(DRPM_UNSIGNED_URL)
    except:  # noqa:E722
        _SIGNED_PACKAGES.clear()
        _UNSIGNED_PACKAGES.clear()
        raise
Exemple #2
0
def setUpModule():  # pylint:disable=invalid-name
    """Possibly skip tests. Create and sync an RPM repository.

    Skip tests in this module if the RPM plugin is not installed on the target
    Pulp server. Then create an RPM repository with a feed and sync it. Test
    cases may copy data from this repository but should **not** change it.
    """
    set_up_module()
    cfg = config.get_config()
    client = cli.Client(config.get_config())

    # log in, then create repository
    pulp_admin_login(cfg)
    client.run('pulp-admin rpm repo create --repo-id {} --feed {}'.format(
        _REPO_ID, RPM_UNSIGNED_FEED_URL).split())

    # If setUpModule() fails, tearDownModule() isn't run. In addition, we can't
    # use addCleanup(), as it's an instance method. If this set-up procedure
    # grows, consider implementing a stack of tear-down steps instead.
    try:
        client.run('pulp-admin rpm repo sync run --repo-id {}'.format(
            _REPO_ID).split())
    except subprocess.CalledProcessError:
        client.run(
            'pulp-admin rpm repo delete --repo-id {}'.format(_REPO_ID).split())
        raise
Exemple #3
0
def setUpModule():  # pylint:disable=invalid-name
    """Maybe skip this module of tests."""
    set_up_module()
    cfg = config.get_config()
    if (cfg.pulp_version >= Version('2.15.1')
            and not selectors.bug_is_fixed(3310, cfg.pulp_version)):
        raise unittest.SkipTest('https://pulp.plan.io/issues/3310')
Exemple #4
0
def setUpModule():  # pylint:disable=invalid-name
    """Possibly skip the tests in this module. Create and sync an RPM repo.

    Skip this module of tests if Pulp is older than version 2.9. (See `Pulp
    #1724`_.) Then create an RPM repository with a feed and sync it. Test cases
    may copy data from this repository but should **not** change it.

    .. _Pulp #1724: https://pulp.plan.io/issues/1724
    """
    set_up_module()
    cfg = config.get_config()
    if cfg.pulp_version < Version('2.9'):
        raise unittest.SkipTest('This module requires Pulp 2.9 or greater.')
    if check_issue_2277(cfg):
        raise unittest.SkipTest('https://pulp.plan.io/issues/2277')

    # Create and sync a repository.
    client = api.Client(cfg, api.json_handler)
    _CLEANUP.append((client.delete, [ORPHANS_PATH], {}))
    body = gen_repo()
    body['importer_config']['feed'] = RPM_SIGNED_FEED_URL
    _REPO.clear()
    _REPO.update(client.post(REPOSITORY_PATH, body))
    _CLEANUP.append((client.delete, [_REPO['_href']], {}))
    try:
        sync_repo(cfg, _REPO)
    except (exceptions.CallReportError, exceptions.TaskReportError,
            exceptions.TaskTimedOutError):
        tearDownModule()
        raise
Exemple #5
0
def setUpModule():  # pylint:disable=invalid-name
    """Conditionally skip tests. Create repositories with fixture data."""
    cfg = config.get_config()
    if not selectors.bug_is_fixed(1991, cfg.pulp_version):
        raise unittest.SkipTest('https://pulp.plan.io/issues/1991')
    set_up_module()

    # Fetch RPMs.
    _SIGNED_PACKAGES['rpm'] = utils.http_get(RPM_SIGNED_URL)
    _SIGNED_PACKAGES['srpm'] = utils.http_get(SRPM_SIGNED_URL)
    _UNSIGNED_PACKAGES['rpm'] = utils.http_get(RPM_UNSIGNED_URL)
    _UNSIGNED_PACKAGES['srpm'] = utils.http_get(SRPM_UNSIGNED_URL)
    if selectors.bug_is_fixed(1806, cfg.pulp_version):
        _SIGNED_PACKAGES['drpm'] = utils.http_get(DRPM_SIGNED_URL)
        _UNSIGNED_PACKAGES['drpm'] = utils.http_get(DRPM_UNSIGNED_URL)

    # Create repos, and upload RPMs to them.
    client = api.Client(cfg, api.json_handler)
    try:
        repo = client.post(REPOSITORY_PATH, gen_repo())
        _REPOS['signed'] = repo
        for type_id, pkg in _SIGNED_PACKAGES.items():
            upload_import_unit(cfg, pkg, {'unit_type_id': type_id}, repo)

        repo = client.post(REPOSITORY_PATH, gen_repo())
        _REPOS['unsigned'] = repo
        for type_id, pkg in _UNSIGNED_PACKAGES.items():
            upload_import_unit(cfg, pkg, {'unit_type_id': type_id}, repo)
    except:  # noqa:E722
        _SIGNED_PACKAGES.clear()
        _UNSIGNED_PACKAGES.clear()
        for _ in range(len(_REPOS)):
            client.delete(_REPOS.popitem()[1]['_href'])
        raise
Exemple #6
0
def setUpModule():  # pylint:disable=invalid-name
    """Conditionally skip tests."""
    if not selectors.bug_is_fixed(1991, config.get_config().pulp_version):
        raise unittest.SkipTest('https://pulp.plan.io/issues/1991')
    if not selectors.bug_is_fixed(2242, config.get_config().pulp_version):
        raise unittest.SkipTest('https://pulp.plan.io/issues/2242')
    set_up_module()
Exemple #7
0
def setUpModule():  # pylint:disable=invalid-name
    """Possibly skip the tests in this module.

    Skip tests if `Pulp #2277 <https://pulp.plan.io/issues/2277>`_ affects us.
    """
    set_up_module()
    if check_issue_2277(config.get_config()):
        raise unittest.SkipTest('https://pulp.plan.io/issues/2277')
Exemple #8
0
def setUpModule():  # pylint:disable=invalid-name
    """Execute ``pulp-admin login`` and reset Pulp.

    For :class:`RemovedContentTestCase` to function correctly, we require that
    all of the content units on Pulp's filesystem belong to the repository
    created by that test case. Resetting Pulp guarantees that this is so.
    Ideally, all test cases would clean up after themselves so that no resets
    are necessary.
    """
    cfg = config.get_config()
    set_up_module()
    reset_pulp(cfg)
    pulp_admin_login(cfg)
Exemple #9
0
def setUpModule():  # pylint:disable=invalid-name
    """Skip tests if the RPM plugin is not installed."""
    set_up_module()
    cfg = config.get_config()
    if cfg.pulp_version < Version('2.8'):
        raise unittest.SkipTest('This module requires Pulp 2.8 or greater.')
    if os_is_f26(cfg) and not selectors.bug_is_fixed(3036, cfg.pulp_version):
        raise unittest.SkipTest('https://pulp.plan.io/issues/3036')
    if check_issue_2798(cfg):
        raise unittest.SkipTest('https://pulp.plan.io/issues/2798')
    if check_issue_2387(cfg):
        raise unittest.SkipTest('https://pulp.plan.io/issues/2387')
    if not selectors.bug_is_fixed(2272, cfg.pulp_version):
        raise unittest.SkipTest('https://pulp.plan.io/issues/2272')
    if not selectors.bug_is_fixed(2144, cfg.pulp_version):
        raise unittest.SkipTest('https://pulp.plan.io/issues/2144')
def setUpModule():  # pylint:disable=invalid-name
    """Conditionally skip the tests in this module.

    Skip the tests in this module if:

    * The RPM plugin is not installed on the target Pulp server.
    * `Pulp #1759`_ is not implemented on the target Pulp server.
    * `Pulp #3313`_ is not fixed on the target Pulp server, and the target host
      is running Fedora 27.

    .. _Pulp #1759: https://pulp.plan.io/issues/1759
    .. _Pulp #3313: https://pulp.plan.io/issues/3313
    """
    set_up_module()
    cfg = config.get_config()
    if not selectors.bug_is_fixed(1759, cfg.pulp_version):
        raise unittest.SkipTest('https://pulp.plan.io/issues/1759')
    if not selectors.bug_is_fixed(3313, cfg.pulp_version) and os_is_f27(cfg):
        raise unittest.SkipTest('https://pulp.plan.io/issues/3313')
    if cfg.pulp_selinux_enabled:
        set_pulp_manage_rsync(cfg, True)
Exemple #11
0
def setUpModule():  # pylint:disable=invalid-name
    """Conditionally skip this module, and execute ``pulp-admin login``."""
    set_up_module()
    pulp_admin_login(config.get_config())
Exemple #12
0
def setUpModule():  # pylint:disable=invalid-name
    """Maybe skip this module of tests."""
    set_up_module()
    if check_issue_2620(config.get_config()):
        raise unittest.SkipTest('https://pulp.plan.io/issues/2620')
Exemple #13
0
def setUpModule():  # pylint:disable=invalid-name
    """Execute ``pulp-admin login`` on the target Pulp system."""
    set_up_module()
    pulp_admin_login(config.get_config())