-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This test will perform the following operations: - Collect the enabled repositories prior to the analysis start - Run the analysis and assert that we successfully enabled the RHSM repositories - Collect the enabled repositories after the tool run to compare with the repositories prior to the analysis
- Loading branch information
Showing
4 changed files
with
78 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
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
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
48 changes: 48 additions & 0 deletions
48
...s/integration/tier0/destructive/offline-system-conversion/test_offline_system_analysis.py
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,48 @@ | ||
import pytest | ||
|
||
from conftest import TEST_VARS | ||
|
||
|
||
def collect_enabled_repositories(shell): | ||
""" | ||
Collect the enabled repositories through a subscription-manager call. | ||
This function will return a list of repositories enabled. | ||
""" | ||
raw_output = shell("subscription-manager repos --list-enabled").output | ||
assert raw_output | ||
|
||
enabled_repositories = [] | ||
for line in raw_output.splitlines(): | ||
if line.startswith("Repo ID:"): | ||
# Get the repo_id as in that split it will be the last thing in the | ||
# array. | ||
repo_id = line.split("Repo ID:")[-1] | ||
enabled_repositories.append(repo_id) | ||
|
||
return enabled_repositories | ||
|
||
|
||
@pytest.mark.test_offline_system_analysis | ||
def test_offline_system_analysis(shell, convert2rhel): | ||
"""Test analysis systems not connected to the Internet but requiring sub-mgr (e.g. managed by Satellite). | ||
This test will perform the following operations: | ||
- Collect the enabled repositories prior to the analysis start | ||
- Run the analysis and assert that we successfully enabled the RHSM repositories | ||
- Collect the enabled repositories after the tool run to compare with the repositories prior to the analysis | ||
""" | ||
|
||
enabled_repositories_prior_analysis = collect_enabled_repositories(shell) | ||
|
||
with convert2rhel( | ||
"analysis -y -k {} -o {} --debug".format( | ||
TEST_VARS["SATELLITE_KEY"], | ||
TEST_VARS["SATELLITE_ORG"], | ||
) | ||
) as c2r: | ||
c2r.expect("Rollback: Enabling RHSM repositories") | ||
assert c2r.exitstatus == 0 | ||
|
||
enabled_repositories_after_analysis = collect_enabled_repositories(shell) | ||
assert enabled_repositories_prior_analysis == enabled_repositories_after_analysis |