Skip to content

Commit

Permalink
[6.15.z] Fix Upgrade scenarios (#16731)
Browse files Browse the repository at this point in the history
  • Loading branch information
Satellite-QE authored Oct 22, 2024
1 parent 1a9aa60 commit 800b10e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
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,
'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

0 comments on commit 800b10e

Please sign in to comment.