From 8024827c5afb9a42b56439e82b5b5111d74122d8 Mon Sep 17 00:00:00 2001 From: Peter Ondrejka Date: Tue, 6 Aug 2024 10:56:56 +0200 Subject: [PATCH] capsule upgrade playbook -- don't specify target version --- tests/foreman/api/test_remoteexecution.py | 48 +++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/tests/foreman/api/test_remoteexecution.py b/tests/foreman/api/test_remoteexecution.py index 36acbbb18e6..a551e3a3f88 100644 --- a/tests/foreman/api/test_remoteexecution.py +++ b/tests/foreman/api/test_remoteexecution.py @@ -15,11 +15,8 @@ import pytest from robottelo.config import settings -from robottelo.hosts import get_sat_version from robottelo.utils import ohsnap -CAPSULE_TARGET_VERSION = f'6.{get_sat_version().minor}.z' - @pytest.mark.tier4 def test_positive_find_capsule_upgrade_playbook(target_sat): @@ -38,6 +35,51 @@ def test_positive_find_capsule_upgrade_playbook(target_sat): assert len(templates) > 0 +@pytest.mark.tier4 +def test_positive_run_capsule_update_playbook(module_capsule_configured, target_sat): + """Run Capsule Upgrade playbook against an External Capsule + + :id: 9ec6903d-2bb7-46a5-8002-afc74f06d83b + + :steps: + 1. Create a Capsule VM, add REX key. + 2. Run the Capsule Upgrade Playbook. + + :expectedresults: Capsule is upgraded successfully + + :CaseImportance: Medium + """ + + template_name = 'Capsule Update Playbook' + template_id = ( + target_sat.api.JobTemplate().search(query={'search': f'name="{template_name}"'})[0].id + ) + module_capsule_configured.add_rex_key(satellite=target_sat) + job = target_sat.api.JobInvocation().run( + synchronous=False, + data={ + 'job_template_id': template_id, + 'inputs': { + '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 {'Dynflow', 'Script', 'Pulpcore', 'Logs'}.issubset(feature_set) + + @pytest.mark.tier3 @pytest.mark.no_containers @pytest.mark.rhel_ver_list('8')