forked from SatelliteQE/robottelo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test Coverage for FDI version verification (SatelliteQE#13209)
* Test Coverage for FDI version verification * Removed unwanted code * Using foreman-maintain for installation * Using Version
- Loading branch information
1 parent
acac82f
commit ef84148
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
"""Test Discovery Plugin related Upgrade Scenario's | ||
:Requirement: UpgradedSatellite | ||
:CaseAutomation: Automated | ||
:CaseLevel: Acceptance | ||
:CaseComponent: DiscoveryImage | ||
:Team: Rocket | ||
:TestType: Functional | ||
:CaseImportance: High | ||
:Upstream: No | ||
""" | ||
import re | ||
|
||
from packaging.version import Version | ||
import pytest | ||
|
||
|
||
class TestDiscoveryImage: | ||
"""Pre-upgrade and post-upgrade scenarios to test Foreman Discovery Image version. | ||
Test Steps: | ||
1. Before Satellite upgrade, Check the FDI version on the Satellite | ||
2. Upgrade satellite. | ||
3. Check the FDI version on the Satellite after upgrade to make sure its same or greater. | ||
""" | ||
|
||
@pytest.mark.pre_upgrade | ||
def test_pre_upgrade_fdi_version(self, target_sat, save_test_data, request): | ||
"""Test FDI version before upgrade. | ||
:id: preupgrade-8c94841c-6791-4af0-aa9c-e54c8d8b9a92 | ||
:steps: | ||
1. Check installed version of FDI | ||
:expectedresults: Version should be saved and checked post-upgrade | ||
""" | ||
target_sat.register_to_cdn() | ||
target_sat.execute('foreman-maintain packages install -y foreman-discovery-image') | ||
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}) | ||
|
||
@pytest.mark.post_upgrade(depend_on=test_pre_upgrade_fdi_version) | ||
def test_post_upgrade_fdi_version(self, target_sat, pre_upgrade_data): | ||
"""Test FDI version post upgrade. | ||
:id: postugrade-38bdecaa-2b50-434b-90b1-4aa2b600d04e | ||
:steps: | ||
1. Check installed version of FDI | ||
:expectedresults: Version should be greater than or equal to pre_upgrade version | ||
""" | ||
pre_upgrade_version = pre_upgrade_data.get('pre_upgrade_version') | ||
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 | ||
target_sat.unregister() |