From e5886cd600493536a18e6b8a52e23851fe3318f5 Mon Sep 17 00:00:00 2001 From: Peter Ondrejka Date: Mon, 17 Oct 2022 15:44:57 +0200 Subject: [PATCH] fixes in capsule upgrade playbook tests --- tests/foreman/api/test_remoteexecution.py | 4 ++-- .../foreman/destructive/test_remoteexecution.py | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/foreman/api/test_remoteexecution.py b/tests/foreman/api/test_remoteexecution.py index 7004630c38d..ee2c26fd33c 100644 --- a/tests/foreman/api/test_remoteexecution.py +++ b/tests/foreman/api/test_remoteexecution.py @@ -19,9 +19,9 @@ import pytest from robottelo.api.utils import wait_for_tasks +from robottelo.hosts import get_sat_version - -CAPSULE_TARGET_VERSION = '6.10.z' +CAPSULE_TARGET_VERSION = f'6.{get_sat_version().minor}.z' @pytest.mark.tier4 diff --git a/tests/foreman/destructive/test_remoteexecution.py b/tests/foreman/destructive/test_remoteexecution.py index d4aaef8dbad..921abb3d02e 100644 --- a/tests/foreman/destructive/test_remoteexecution.py +++ b/tests/foreman/destructive/test_remoteexecution.py @@ -21,8 +21,10 @@ from nailgun import client from nailgun.entity_mixins import TaskFailedError +from robottelo.config import get_credentials +from robottelo.hosts import get_sat_version -CAPSULE_TARGET_VERSION = '6.10.z' +CAPSULE_TARGET_VERSION = f'6.{get_sat_version().minor}.z' pytestmark = pytest.mark.destructive @@ -41,7 +43,6 @@ def test_negative_run_capsule_upgrade_playbook_on_satellite(target_sat): :CaseImportance: Medium """ - sat = target_sat.nailgun_host template_id = ( target_sat.api.JobTemplate() .search(query={'search': 'name="Capsule Upgrade Playbook"'})[0] @@ -58,16 +59,20 @@ def test_negative_run_capsule_upgrade_playbook_on_satellite(target_sat): 'whitelist_options': "repositories-validqqate,repositories-setup", }, 'targeting_type': "static_query", - 'search_query': f"name = {sat.name}", + 'search_query': f"name = {target_sat.hostname}", } ) assert 'A sub task failed' in error.value.args[0] job = target_sat.api.JobInvocation().search( - query={'search': f'host={sat.name},status=failed,description="Capsule Upgrade Playbook"'} + query={ + 'search': f'host={target_sat.hostname},' + 'status=failed,description="Capsule Upgrade Playbook"' + } )[0] + host = target_sat.api.Host().search(query={'search': target_sat.hostname}) response = client.get( - f'{target_sat.url}/api/job_invocations/{job.id}/hosts/{sat.id}', - auth=(target_sat.username, target_sat.password), + f'{target_sat.url}/api/job_invocations/{job.id}/hosts/{host[0].id}', + auth=get_credentials(), verify=False, ) assert 'This playbook cannot be executed on a Satellite server.' in response.text