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

Fix Upgrade scenarios #16477

Merged
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
6 changes: 3 additions & 3 deletions tests/upgrades/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TestDiscoveryImage:
"""

@pytest.mark.pre_upgrade
def test_pre_upgrade_fdi_version(self, target_sat, save_test_data, request):
def test_pre_upgrade_fdi_version(self, target_sat, save_test_data):
"""Test FDI version before upgrade.

:id: preupgrade-8c94841c-6791-4af0-aa9c-e54c8d8b9a92
Expand All @@ -43,7 +43,7 @@ def test_pre_upgrade_fdi_version(self, target_sat, save_test_data, request):
fdi_package = target_sat.execute('rpm -qa *foreman-discovery-image*').stdout
# Note: The regular exp takes care of format digit.digit.digit or digit.digit.digit-digit in the output
pre_upgrade_version = Version(re.search(r'\d+\.\d+\.\d+(-\d+)?', fdi_package).group())
save_test_data({'pre_upgrade_version': pre_upgrade_version})
save_test_data({'pre_upgrade_version': str(pre_upgrade_version)})

@pytest.mark.post_upgrade(depend_on=test_pre_upgrade_fdi_version)
def test_post_upgrade_fdi_version(self, target_sat, pre_upgrade_data):
Expand All @@ -60,5 +60,5 @@ def test_post_upgrade_fdi_version(self, target_sat, pre_upgrade_data):
fdi_package = target_sat.execute('rpm -qa *foreman-discovery-image*').stdout
# Note: The regular exp takes care of format digit.digit.digit or digit.digit.digit-digit in the output
post_upgrade_version = Version(re.search(r'\d+\.\d+\.\d+(-\d+)?', fdi_package).group())
assert post_upgrade_version >= pre_upgrade_version
assert post_upgrade_version >= Version(pre_upgrade_version)
target_sat.unregister()
10 changes: 3 additions & 7 deletions tests/upgrades/test_provisioningtemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

"""

import json

from fauxfactory import gen_string
import pytest

Expand Down Expand Up @@ -75,13 +73,11 @@ def test_pre_scenario_provisioning_templates(

for kind in provisioning_template_kinds:
assert host.read_template(data={'template_kind': kind})

pre_update_data_dict = {
'provision_host_id': host.id,
'provision_host_name': host.name,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does host.id change after upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Host.name would be more reliable here. Id doesn't change

Copy link
Collaborator

Choose a reason for hiding this comment

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

@shweta83 I think it doesn't matter if use either name or id, both should be same, but I'd like to understand rational behind changing it from id to name

'pxe_loader': pxe_loader.pxe_loader,
}
pre_update_json_file = json.dumps(pre_update_data_dict, indent=2)
save_test_data(pre_update_json_file)
save_test_data(pre_update_data_dict)

@pytest.mark.post_upgrade(depend_on=test_pre_scenario_provisioning_templates)
@pytest.mark.parametrize('pre_upgrade_data', ['bios', 'uefi'], indirect=True)
Expand All @@ -106,7 +102,7 @@ def test_post_scenario_provisioning_templates(
"""
pxe_loader = pre_upgrade_data.pxe_loader
pre_upgrade_host = module_target_sat.api.Host().search(
query={'search': f'id={pre_upgrade_data.provision_host_id}'}
query={'search': f'name={pre_upgrade_data.provision_host_name}'}
)[0]
request.addfinalizer(pre_upgrade_host.delete)
org = module_target_sat.api.Organization(id=pre_upgrade_host.organization.id).read()
Expand Down