-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rodolfo Olivieri <[email protected]>
- Loading branch information
Showing
5 changed files
with
75 additions
and
1 deletion.
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
4 changes: 4 additions & 0 deletions
4
tests/integration/tier0/single-yum-transaction-validation/main.fmf
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,4 @@ | ||
summary: single-yum-transaction-validation | ||
|
||
tier: 0 | ||
test: pytest -svv |
63 changes: 63 additions & 0 deletions
63
tests/integration/tier0/single-yum-transaction-validation/test_remove_entitlement_keys.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,63 @@ | ||
import os | ||
import shutil | ||
|
||
from conftest import SYSTEM_RELEASE | ||
from envparse import env | ||
|
||
|
||
PKI_ENTITLEMENT_KEYS_PATH = "/etc/pki/entitlement" | ||
|
||
|
||
def backup_entitlement_keys(): | ||
original_keys = os.listdir(PKI_ENTITLEMENT_KEYS_PATH) | ||
|
||
for key in original_keys: | ||
full_key = "{}/{}".format(PKI_ENTITLEMENT_KEYS_PATH, key) | ||
new_key = "{}.bk".format(full_key) | ||
shutil.move(full_key, new_key) | ||
|
||
|
||
def rollback_entitlement_keys(): | ||
backup_keys = os.listdir(PKI_ENTITLEMENT_KEYS_PATH) | ||
|
||
for key in backup_keys: | ||
# This is already in the format with a .bk at the end of it | ||
backup_key = "{}/{}".format(PKI_ENTITLEMENT_KEYS_PATH, key) | ||
original_key = "{}".format(backup_key) | ||
shutil.move(backup_key, original_key) | ||
|
||
|
||
def test_remove_entitlement_keys(convert2rhel, shell): | ||
"""Run the conversion using the single yum transaction. | ||
This will run the conversion up until the point of the single yum | ||
transaction package replacements. | ||
""" | ||
|
||
server_sub = "CentOS Linux" | ||
pkgmanager = "yum" | ||
if "oracle" in SYSTEM_RELEASE: | ||
server_sub = "Oracle Linux Server" | ||
|
||
if "8" in SYSTEM_RELEASE: | ||
pkgmanager = "dnf" | ||
|
||
with convert2rhel( | ||
"-y --no-rpm-va --serverurl {} --username {} --password {} --pool {} --debug".format( | ||
env.str("RHSM_SERVER_URL"), | ||
env.str("RHSM_USERNAME"), | ||
env.str("RHSM_PASSWORD"), | ||
env.str("RHSM_POOL"), | ||
) | ||
) as c2r: | ||
c2r.expect( | ||
"Validating the {} transaction set, no modifications to the system will happen this time.".format( | ||
pkgmanager | ||
) | ||
) | ||
backup_entitlement_keys() | ||
assert c2r.expect_exact("Failed to download the transaction packages.", timeout=600) == 0 | ||
|
||
assert c2r.exitstatus == 1 | ||
|
||
rollback_entitlement_keys() |
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