Skip to content

Commit

Permalink
Fix cli hosts erratum tests (SatelliteQE#9696)
Browse files Browse the repository at this point in the history
* fix erratum tests

* add ids to tests
  • Loading branch information
peterdragun authored Jun 22, 2022
1 parent 9fda8db commit 03e4aa7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,8 @@
FAKE_5_CUSTOM_PACKAGE = 'kangaroo-0.2-1.noarch' # for RHBA-2012:1030
FAKE_6_CUSTOM_PACKAGE = 'kangaroo-0.3-1.noarch' # for RHEA-2012:0059
FAKE_7_CUSTOM_PACKAGE = 'rabbit-1.5.6-1.noarch' # for RHEA-2012:61
FAKE_8_CUSTOM_PACKAGE = 'rabbit-3.8.12-1.noarch' # for RHEA-2012:9245
FAKE_8_CUSTOM_PACKAGE_NAME = 'rabbit'
REAL_0_RH_PACKAGE = 'rhev-agent-2.3.16-3.el6.x86_64'
REAL_RHEL7_0_0_PACKAGE = 'python-pulp-common-2.21.0-1.el7sat.noarch'
REAL_RHEL7_0_0_PACKAGE_NAME = 'python-pulp-common'
Expand Down
21 changes: 15 additions & 6 deletions tests/foreman/cli/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@
from robottelo.constants import FAKE_1_CUSTOM_PACKAGE
from robottelo.constants import FAKE_1_CUSTOM_PACKAGE_NAME
from robottelo.constants import FAKE_2_CUSTOM_PACKAGE
from robottelo.constants import FAKE_2_CUSTOM_PACKAGE_NAME
from robottelo.constants import FAKE_7_CUSTOM_PACKAGE
from robottelo.constants import FAKE_8_CUSTOM_PACKAGE
from robottelo.constants import FAKE_8_CUSTOM_PACKAGE_NAME
from robottelo.constants import NO_REPOS_AVAILABLE
from robottelo.constants import PRDS
from robottelo.constants import REPOS
Expand Down Expand Up @@ -1572,8 +1573,11 @@ def test_positive_provision_baremetal_with_uefi_secureboot():


@pytest.fixture(scope="function")
def setup_custom_repo(module_org, katello_host_tools_host, custom_repo='yum_6'):
def setup_custom_repo(request, module_org, katello_host_tools_host):
"""Create custom repository content"""
custom_repo = 'yum_6'
if hasattr(request, 'param'):
custom_repo = request.param.get('custom_repo', 'yum_6')
custom_repo_url = settings.repos[custom_repo].url
prod = entities.Product(organization=module_org, name=f'custom_{gen_string("alpha")}').create()
custom_repo = entities.Repository(
Expand Down Expand Up @@ -1723,7 +1727,9 @@ def test_positive_package_applicability(katello_host_tools_host, setup_custom_re
@pytest.mark.pit_client
@pytest.mark.pit_server
@pytest.mark.tier3
@pytest.mark.parametrize('setup_custom_repo', [{'custom_repo': 'yum_3'}], ids=[''], indirect=True)
@pytest.mark.parametrize(
'setup_custom_repo', [{'custom_repo': 'yum_3'}], ids=['yum3'], indirect=True
)
def test_positive_erratum_applicability(
katello_host_tools_host, setup_custom_repo, yum_security_plugin
):
Expand Down Expand Up @@ -1778,6 +1784,9 @@ def test_positive_erratum_applicability(

@pytest.mark.cli_katello_host_tools
@pytest.mark.tier3
@pytest.mark.parametrize(
'setup_custom_repo', [{'custom_repo': 'yum_3'}], ids=['yum3'], indirect=True
)
def test_positive_apply_security_erratum(katello_host_tools_host, setup_custom_repo):
"""Apply security erratum to a host
Expand All @@ -1796,16 +1805,16 @@ def test_positive_apply_security_erratum(katello_host_tools_host, setup_custom_r
"""
client = katello_host_tools_host
host_info = Host.info({'name': client.hostname})
client.download_install_rpm(settings.repos.yum_6.url, FAKE_2_CUSTOM_PACKAGE)
client.run(f'yum downgrade -y {FAKE_2_CUSTOM_PACKAGE_NAME}')
client.download_install_rpm(settings.repos.yum_3.url, FAKE_8_CUSTOM_PACKAGE)
client.run(f'yum downgrade -y {FAKE_8_CUSTOM_PACKAGE_NAME}')
# Check that host has applicable errata
host_erratum, _ = wait_for(
lambda: Host.errata_list({'host-id': host_info['id']})[0],
handle_exception=True,
timeout=120,
delay=5,
)
assert host_erratum['erratum-id'] == settings.repos.yum_6.errata[2]
assert host_erratum['erratum-id'] == settings.repos.yum_3.errata[25]
assert host_erratum['installable'] == 'true'
# Check the erratum becomes available
result = client.run('yum update --assumeno --security | grep "No packages needed for security"')
Expand Down

0 comments on commit 03e4aa7

Please sign in to comment.