ipatests: test removing last KRA when it is not running

Use the new role-based mechanism, one that doesn't rely
on direct communication to the server, to determine whether
the server being removed by `ipa server-del` contains the
last KRA server.

https://pagure.io/freeipa/issue/8397

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Francois Cami <fcami@redhat.com>
This commit is contained in:
Rob Crittenden 2021-07-19 21:54:22 -04:00
parent 10bd66dd1a
commit 2097776e5e

View File

@ -302,6 +302,23 @@ class TestLastServices(ServerDelBase):
1
)
def test_removal_of_server_raises_error_about_last_kra(self):
"""
test that removal of server fails on the last KRA
We shut it down to verify that it can be removed if it failed.
"""
tasks.install_kra(self.master)
self.master.run_command(['ipactl', 'stop'])
tasks.assert_error(
tasks.run_server_del(self.replicas[0], self.master.hostname),
"Deleting this server is not allowed as it would leave your "
"installation without a KRA.",
1
)
# Restarting the server we stopped is not necessary as it will
# be removed in the next test.
def test_forced_removal_of_master(self):
"""
Tests that we can still force remove the master using