Skip to content

Commit

Permalink
Updating tests to use many hosts and fixing sca
Browse files Browse the repository at this point in the history
  • Loading branch information
ColeHiggins2 committed Apr 9, 2024
1 parent ce6777c commit ebe8bc5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
7 changes: 6 additions & 1 deletion robottelo/host_helpers/cli_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,12 @@ def _setup_org_for_a_rh_repo(self, options=None):
# Promote version1 to next env
try:
self._satellite.cli.ContentView.version_promote(
{'id': cvv['id'], 'organization-id': org_id, 'to-lifecycle-environment-id': env_id}
{
'id': cvv['id'],
'organization-id': org_id,
'to-lifecycle-environment-id': env_id,
'force': True,
}
)
except CLIReturnCodeError as err:
raise CLIFactoryError(
Expand Down
21 changes: 12 additions & 9 deletions tests/foreman/api/test_reporttemplates.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ def test_positive_schedule_entitlements_report(setup_content, target_sat):

@pytest.mark.no_containers
@pytest.mark.tier3
def test_positive_generate_job_report(setup_content, target_sat, rhel7_contenthost):
def test_positive_generate_job_report(setup_content, target_sat, content_hosts):
"""Generate a report using the Job - Invocation Report template.
:id: 946c39db-3061-43d7-b922-1be61f0c7d93
Expand All @@ -685,11 +685,12 @@ def test_positive_generate_job_report(setup_content, target_sat, rhel7_contentho
:customerscenario: true
"""
ak, org = setup_content
rhel7_contenthost.install_katello_ca(target_sat)
rhel7_contenthost.register_contenthost(org.label, ak.name)
rhel7_contenthost.add_rex_key(target_sat)
assert rhel7_contenthost.subscribed
# Run a Job on the Host
for host in content_hosts:
host.install_katello_ca(target_sat)
host.register_contenthost(org.label, ak.name)
host.add_rex_key(target_sat)
assert host.subscribed
# Run a Job on the Host
template_id = (
target_sat.api.JobTemplate()
.search(query={'search': 'name="Run Command - Script Default"'})[0]
Expand All @@ -703,12 +704,12 @@ def test_positive_generate_job_report(setup_content, target_sat, rhel7_contentho
'command': 'pwd',
},
'targeting_type': 'static_query',
'search_query': f'name = {rhel7_contenthost.hostname}',
'search_query': f'name ^ ({content_hosts[0].hostname} && {content_hosts[1].hostname}',
},
)
target_sat.wait_for_tasks(f'resource_type = JobInvocation and resource_id = {job["id"]}')
result = target_sat.api.JobInvocation(id=job['id']).read()
assert result.succeeded == 1
assert result.succeeded == 2
rt = (
target_sat.api.ReportTemplate()
.search(query={'search': 'name="Job - Invocation Report"'})[0]
Expand All @@ -721,8 +722,10 @@ def test_positive_generate_job_report(setup_content, target_sat, rhel7_contentho
'input_values': {"job_id": job["id"]},
}
)
assert res[0]['Host'] == rhel7_contenthost.hostname
assert res[0]['Host'] == content_hosts[0].hostname
assert res[1]['Host'] == content_hosts[1].hostname
assert '/root' in res[0]['stdout']
assert res[1]['stdout']


@pytest.mark.tier2
Expand Down
1 change: 1 addition & 0 deletions tests/foreman/cli/test_reporttemplates.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ def test_positive_generate_ansible_template(module_target_sat):
assert host['name'] in [item.split(',')[1] for item in report_data.split('\n') if len(item) > 0]


@pytest.mark.no_containers
@pytest.mark.tier3
def test_positive_generate_entitlements_report_multiple_formats(
module_entitlement_manifest_org, local_ak, local_subscription, rhel7_contenthost, target_sat
Expand Down

0 comments on commit ebe8bc5

Please sign in to comment.