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

fixes in capsule upgrade playbook tests #10173

Merged
merged 1 commit into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions tests/foreman/api/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 11 additions & 6 deletions tests/foreman/destructive/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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]
Expand All @@ -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}',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the following patch, you can delete L72.

Suggested change
f'{target_sat.url}/api/job_invocations/{job.id}/hosts/{host[0].id}',
f'{target_sat.url}/api/job_invocations/{job.id}/hosts/{target_sat.nailgun_host.id}',

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, for some reason this didn't work for me when I was trying that out locally

auth=get_credentials(),
verify=False,
)
assert 'This playbook cannot be executed on a Satellite server.' in response.text
Expand Down