Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
damoore044 committed May 17, 2024
1 parent 45cff78 commit 6dfa067
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions tests/foreman/ui/test_errata.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def registered_contenthost(
# found index (repo) with matching name, grab sub-manager repo-id:
assert repo.name in repo_ids_names['names']
sub_man_repo_id = repo_ids_names['ids'][repo_ids_names['names'].index(repo.name)]
# repo present, and can be enabled without error
# repo can be enabled by id without error
enable_repo = client.execute(f'subscription-manager repos --enable {sub_man_repo_id}')
assert enable_repo.status == 0, (
f'Failed to enable a repository with subscription-manager, on client: {client.hostname}.'
Expand Down Expand Up @@ -569,7 +569,7 @@ def test_end_to_end(

@pytest.mark.tier2
@pytest.mark.no_containers
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('[^6]')
@pytest.mark.parametrize('registered_contenthost', [[CUSTOM_REPO_3_URL]], indirect=True)
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_host_content_errata_tab_pagination(
Expand Down Expand Up @@ -972,15 +972,17 @@ def test_positive_apply_for_all_hosts(
:expectedresults: Check that the erratum is applied in all the content
hosts.
"""
num_hosts = 4
distro = 'rhel9'
# one custom repo on satellite, for all hosts to use
custom_repo = target_sat.api.Repository(url=CUSTOM_REPO_URL, product=module_product).create()
custom_repo.sync()
module_cv.repository = [custom_repo]
module_cv.update(['repository'])
with Broker(
nick='rhel9', workflow='deploy-rhel', host_class=ContentHost, _count=4,
nick=distro, workflow='deploy-rhel', host_class=ContentHost, _count=num_hosts,
) as hosts:
if not isinstance(hosts, list) or len(hosts) != 4:
if not isinstance(hosts, list) or len(hosts) != num_hosts:
pytest.fail('Failed to provision the expected number of hosts.')
for client in hosts:
# setup/register all hosts to same ak, content-view, and the one custom repo
Expand All @@ -995,21 +997,35 @@ def test_positive_apply_for_all_hosts(
assert setup['result'] != 'error', f'{setup["message"]}'
assert (client := setup['client'])
assert client.subscribed
assert client.execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}').status == 0
pkgs = ' '.join(FAKE_9_YUM_OUTDATED_PACKAGES)
assert client.execute(f'yum install -y {pkgs}').status == 0
assert client.execute('subscription-manager repos').status == 0

with session:
session.location.select(loc_name=DEFAULT_LOC)
# for first errata, install in each chost and check, one at a time
for client in hosts:
status = session.contenthost.install_errata(
client.hostname, CUSTOM_REPO_ERRATA_ID, install_via='rex'
)
assert status['overview']['job_status'] == 'Success'
assert status['overview']['job_status_progress'] == '100%'
# check updated package in chost details
assert client.execute('subscription-manager repos').status == 0
packages_rows = session.contenthost.search_package(
client.hostname, FAKE_2_CUSTOM_PACKAGE
)
assert packages_rows[0]['Installed Package'] == FAKE_2_CUSTOM_PACKAGE
# for second errata, install into all chosts at once
# from Content > Errata > info > ContentHosts tab
errata_id = settings.repos.yum_9.errata[4] # RHBA-2012:1030
session.errata.install(
entity_name=errata_id,
host_names="All",
)
# bulk action task for expected hosts

# check each task status and package version, for each chost


@pytest.mark.tier2
Expand Down Expand Up @@ -1267,6 +1283,7 @@ def test_positive_host_content_library(

assert client.applicable_errata_count == 0
assert client.execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}').status == 0
assert client.execute(f'subscription-manager repos').status == 0
assert client.applicable_errata_count == 1
assert client.applicable_package_count == 1

Expand Down Expand Up @@ -1587,6 +1604,7 @@ def test_positive_filtered_errata_status_installable_param(
"""
client = registered_contenthost
assert client.execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}').status == 0
assert client.execute(f'subscription-manager repos').status == 0
# Adding content view filter and content view filter rule to exclude errata,
# for the installed package above.
cv_filter = target_sat.api.ErratumContentViewFilter(
Expand Down Expand Up @@ -1644,12 +1662,12 @@ def test_positive_filtered_errata_status_installable_param(

@pytest.mark.tier3
def test_content_host_errata_search_commands(
session,
target_sat,
module_product,
target_sat,
module_org,
module_ak,
module_cv,
session,
):
"""View a list of affected content hosts for security (RHSA) and bugfix (RHBA) errata,
filtered with errata status and applicable flags. Applicability is calculated using the
Expand Down Expand Up @@ -1699,8 +1717,10 @@ def test_content_host_errata_search_commands(
assert client.subscribed
# Install pkg walrus-0.71-1.noarch to create need for RHSA on client 1
assert clients[0].execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}').status == 0
assert clients[0].execute('subscription-manager repos').status == 0
# Install pkg kangaroo-0.1-1.noarch to create need for RHBA on client 2
assert clients[1].execute(f'yum install -y {FAKE_4_CUSTOM_PACKAGE}').status == 0
assert clients[1].execute('subscription-manager repos').status == 0

with session:
session.location.select(loc_name=DEFAULT_LOC)
Expand Down

0 comments on commit 6dfa067

Please sign in to comment.