Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes to the capsule upgrade playbook test #16321

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 9 additions & 36 deletions tests/foreman/api/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,55 +17,28 @@
from robottelo.config import settings
from robottelo.hosts import get_sat_version
from robottelo.utils import ohsnap
from robottelo.utils.issue_handlers import is_open

CAPSULE_TARGET_VERSION = f'6.{get_sat_version().minor}.z'


@pytest.mark.tier4
def test_positive_run_capsule_upgrade_playbook(module_capsule_configured, target_sat):
"""Run Capsule Upgrade playbook against an External Capsule
def test_positive_find_capsule_upgrade_playbook(target_sat):
"""Check that Capsule Upgrade playbook is present on Satellite

:id: 9ec6903d-2bb7-46a5-8002-afc74f06d83b
:id: 7d9fd42f-289f-4b14-a65e-93ddc8ea759a

:steps:
1. Create a Capsule VM, add REX key.
2. Run the Capsule Upgrade Playbook.

:expectedresults: Capsule is upgraded successfully
:expectedresults: Capsule upgrade playbook is found on Satellite

:BZ: 2152951

:CaseImportance: Medium
"""
template_name = 'Capsule Upgrade Playbook'
template_id = (
target_sat.api.JobTemplate().search(query={'search': f'name="{template_name}"'})[0].id
template_name = (
'Smart Proxy Upgrade Playbook' if is_open('BZ:2152951') else 'Capsule Upgrade Playbook'
)
module_capsule_configured.add_rex_key(satellite=target_sat)
job = target_sat.api.JobInvocation().run(
synchronous=False,
data={
'job_template_id': template_id,
'inputs': {
'target_version': CAPSULE_TARGET_VERSION,
'whitelist_options': 'repositories-validate,repositories-setup,non-rh-packages',
},
'targeting_type': 'static_query',
'search_query': f'name = {module_capsule_configured.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
result = target_sat.execute('satellite-maintain health check')
assert result.status == 0
for line in result.stdout:
assert 'FAIL' not in line
result = target_sat.api.SmartProxy(
id=target_sat.api.SmartProxy(name=target_sat.hostname).search()[0].id
).refresh()
feature_set = {feat['name'] for feat in result['features']}
assert {'Ansible', 'Dynflow', 'Script', 'Pulpcore', 'Logs'}.issubset(feature_set)
templates = target_sat.api.JobTemplate().search(query={'search': f'name="{template_name}"'})
assert len(templates) > 0


@pytest.mark.tier3
Expand Down
Loading