Skip to content

Commit

Permalink
ipatests: add test for PKI subsystem detection
Browse files Browse the repository at this point in the history
Add a new upgrade test. Scenario:
- create an empty /var/lib/pki/pki-tomcat/kra directory
- call ipa-server-upgrade

With issue 8596, the upgrade fails because it assumes KRA is
installed. With the fix, ipa-server-upgrade completes successfully.

Related: https://pagure.io/freeipa/issue/8596
  • Loading branch information
flo-renaud committed Nov 26, 2020
1 parent 968a7f5 commit c46757e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ipatests/test_integration/test_upgrade.py
Expand Up @@ -278,3 +278,22 @@ def test_pwpolicy_upgrade(self):
result = self.master.run_command(["ipa", "pwpolicy-find"])
# if it is still missing the oc it won't be displayed
assert 'global_policy' in result.stdout_text

def test_kra_detection(self):
"""Test that ipa-server-upgrade correctly detects KRA presence
Test for https://pagure.io/freeipa/issue/8596
When the directory /var/lib/pki/pki-tomcat/kra/ exists, the upgrade
wrongly assumes that KRA component is installed and crashes.
The test creates an empty dir and calls ipa-server-upgrade
to make sure that KRA detection is not based on the directory
presence.
"""
kra_path = os.path.join(paths.VAR_LIB_PKI_TOMCAT_DIR, "kra")
try:
self.master.run_command(["mkdir", "-p", kra_path])
result = self.master.run_command(['ipa-server-upgrade'])
err_msg = 'Upgrade failed with no such entry'
assert err_msg not in result.stderr_text
finally:
self.master.run_command(["rmdir", kra_path])

0 comments on commit c46757e

Please sign in to comment.