Skip to content

Commit

Permalink
[Customer Case] Applied Errata report with invalid errata (#15378)
Browse files Browse the repository at this point in the history
* adding tests for invalid errata

* addressing comments
  • Loading branch information
ColeHiggins2 authored Jun 24, 2024
1 parent 372dfdd commit 7fa1c33
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions tests/foreman/api/test_reporttemplates.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,82 @@ def test_positive_applied_errata(
assert res[0]['issued']


@pytest.mark.tier2
@pytest.mark.rhel_ver_match('[^6]')
@pytest.mark.no_containers
def test_positive_applied_errata_report_with_invalid_errata(
function_org, function_location, function_lce, rhel_contenthost, target_sat
):
"""Generate an Applied Errata report after an invalid errata has been applied
:id: cf64f193-870d-4053-ae4b-28148424b2e2
:setup: A Host with some invalid applied errata.
:steps:
1. Apply invalid errata
2. Generate an Applied Errata report
:expectedresults: A report is generated without failures
:BZ: 2176368
:customerscenario: true
"""
activation_key = target_sat.api.ActivationKey(
environment=function_lce, organization=function_org
).create()
cv = target_sat.api.ContentView(organization=function_org).create()
target_sat.cli_factory.setup_org_for_a_custom_repo(
{
'url': settings.repos.yum_6.url,
'organization-id': function_org.id,
'content-view-id': cv.id,
'lifecycle-environment-id': function_lce.id,
'activationkey-id': activation_key.id,
}
)
result = rhel_contenthost.register(
function_org, function_location, activation_key.name, target_sat
)
assert f'The registered system name is: {rhel_contenthost.hostname}' in result.stdout
assert rhel_contenthost.subscribed
rhel_contenthost.execute(r'subscription-manager repos --enable \*')
assert rhel_contenthost.execute(f'yum install -y {FAKE_1_CUSTOM_PACKAGE}').status == 0
assert rhel_contenthost.execute(f'rpm -q {FAKE_1_CUSTOM_PACKAGE}').status == 0
task_id = target_sat.api.JobInvocation().run(
data={
'feature': 'katello_errata_install',
'inputs': {'errata': 'invalid-errata'},
'targeting_type': 'static_query',
'search_query': f'name = {rhel_contenthost.hostname}',
'organization_id': function_org.id,
},
)['id']
target_sat.wait_for_tasks(
search_query=(f'label = Actions::RemoteExecution::RunHostsJob and id = {task_id}'),
search_rate=15,
max_tries=10,
)
rt = (
target_sat.api.ReportTemplate()
.search(query={'search': 'name="Host - Applied Errata"'})[0]
.read()
)
rt.generate(
data={
'organization_id': function_org.id,
'report_format': 'json',
'input_values': {
'Filter Errata Type': 'all',
'Include Last Reboot': 'no',
'Status': 'all',
},
}
)


@pytest.mark.tier2
@pytest.mark.rhel_ver_match('[^6]')
@pytest.mark.no_containers
Expand Down

0 comments on commit 7fa1c33

Please sign in to comment.