def test_vm_install_package(org, lce, distro, cdn):
    """Install a package with all supported distros and cdn / non-cdn variants

    :id: b2a6065a-69f6-4805-a28b-eaaa812e0f4b

    :parametrized: yes

    :expectedresults: Package is install is installed
    """
    if distro == DISTRO_RHEL6:
        pytest.skip(f'{DISTRO_RHEL6!s} skipped until ELS subscriptions are in manifest.')
    repos_collection = RepositoryCollection(
        distro=distro,
        repositories=[
            SatelliteToolsRepository(cdn=cdn, distro=distro),
            YumRepository(url=FAKE_0_YUM_REPO),
            DockerRepository(url=CONTAINER_REGISTRY_HUB, upstream_name=CONTAINER_UPSTREAM_NAME),
            PuppetRepository(
                url=CUSTOM_PUPPET_REPO, modules=[dict(name='generic_1', author='robottelo')]
            ),
        ],
    )
    # Create repos, content view, and activation key.
    repos_collection.setup_content(org['id'], lce['id'], upload_manifest=True)
    with VMBroker(nick=distro, host_classes={'host': ContentHost}) as host:
        # install katello-agent
        repos_collection.setup_virtual_machine(
            host, enable_custom_repos=True, install_katello_agent=False
        )
        # install a package from custom repo
        result = host.execute(f'yum -y install {FAKE_0_CUSTOM_PACKAGE}')
        assert result.status == 0
예제 #2
0
def test_vm_install_package(value, module_org, module_lce):
    """Install a package with all supported distros and cdn not cdn variants

    :id: b2a6065a-69f6-4805-a28b-eaaa812e0f4b

    :expectedresults: Package is install is installed
    """
    # the value is support distro DISTRO_RH6 or DISTRO_RH7
    # this will create 4 tests:
    #  - one test with disto rhel6 cdn False
    #  - one test with distro rhel7 cdn False
    #  - one test with disto rhel6 cdn True
    #  - one test with distro rhel7 cdn True
    distro, cdn = value
    repos_collection = RepositoryCollection(
        distro=distro,
        repositories=[
            SatelliteToolsRepository(cdn=cdn),
            YumRepository(url=FAKE_0_YUM_REPO),
            DockerRepository(url=DOCKER_REGISTRY_HUB, upstream_name=DOCKER_UPSTREAM_NAME),
            PuppetRepository(
                url=CUSTOM_PUPPET_REPO, modules=[dict(name='generic_1', author='robottelo')]
            ),
        ],
    )
    # this will create repositories , content view and activation key
    repos_collection.setup_content(module_org['id'], module_lce['id'], upload_manifest=True)
    with VirtualMachine(distro=distro) as vm:
        # this will install katello ca, register vm host, enable rh repos,
        # install katello-agent
        repos_collection.setup_virtual_machine(vm, enable_custom_repos=True)
        # install a package
        result = vm.run('yum -y install {0}'.format(FAKE_0_CUSTOM_PACKAGE))
        assert result.return_code == 0