Automated ipa-replica-manage del tests

Reviewed-By: Martin Basti <mbasti@redhat.com>
Reviewed-By: Milan Kubik <mkubik@redhat.com>
This commit is contained in:
Oleg Fayans 2016-10-12 13:54:12 +02:00 committed by Martin Basti
parent 6d812a0d52
commit dc58f8f2a1

View File

@ -264,3 +264,75 @@ class TestCASpecificRUVs(IntegrationTest):
master.config.dirman_password]).stdout_text
assert(replica.hostname not in res2), (
"Replica RUVs were not clean during replica uninstallation")
class TestReplicaManageDel(IntegrationTest):
domain_level = 0
topology = 'star'
num_replicas = 3
def test_replica_managed_del_domlevel0(self):
"""
http://www.freeipa.org/page/V4/Manage_replication_topology_4_4/
Test_Plan#Test_case:_ipa-replica-manage_del_with_turned_off_replica
_under_domain_level_0_keeps_ca-related_RUVs
"""
master = self.master
replica = self.replicas[0]
replica.run_command(['ipactl', 'stop'])
master.run_command(['ipa-replica-manage', 'del', '-f', '-p',
master.config.dirman_password, replica.hostname])
result = master.run_command(['ipa-replica-manage', 'list-ruv',
'-p', master.config.dirman_password])
num_ruvs = result.stdout_text.count(replica.hostname)
assert(num_ruvs == 1), ("Expected to find 1 replica's RUV, found %s" %
num_ruvs)
ruvid_re = re.compile(".*%s:389: (\d+).*" % replica.hostname)
replica_ruvs = ruvid_re.findall(result.stdout_text)
master.run_command(['ipa-replica-manage', 'clean-ruv', '-f',
'-p', master.config.dirman_password,
replica_ruvs[0]])
result2 = master.run_command(['ipa-replica-manage', 'list-ruv',
'-p', master.config.dirman_password])
assert(replica.hostname not in result2.stdout_text), (
"Replica's RUV was not properly removed")
def test_clean_dangling_ruv_multi_ca(self):
"""
http://www.freeipa.org/page/V4/Manage_replication_topology_4_4/
Test_Plan#Test_case:_ipa-replica-manage_clean-dangling-ruv_in_a
_multi-CA_setup
"""
master = self.master
replica = self.replicas[1]
replica.run_command(['ipa-server-install', '--uninstall', '-U'])
master.run_command(['ipa-replica-manage', 'del', '-f', '-p',
master.config.dirman_password, replica.hostname])
result1 = master.run_command(['ipa-replica-manage', 'list-ruv', '-p',
master.config.dirman_password])
ruvid_re = re.compile(".*%s:389: (\d+).*" % replica.hostname)
assert(ruvid_re.search(result1.stdout_text)), (
"Replica's RUV should not be removed under domain level 0")
master.run_command(['ipa-replica-manage', 'clean-dangling-ruv', '-p',
master.config.dirman_password], stdin_text="yes\n")
result2 = master.run_command(['ipa-replica-manage', 'list-ruv', '-p',
master.config.dirman_password])
assert(replica.hostname not in result2.stdout_text), (
"Replica's RUV was not removed by a clean-dangling-ruv command")
def test_replica_managed_del_domlevel1(self):
"""
http://www.freeipa.org/page/V4/Manage_replication_topology_4_4/
Test_Plan#Test_case:_ipa-replica-manage_del_with_turned_off_replica
_under_domain_level_1_removes_ca-related_RUVs
"""
master = self.master
replica = self.replicas[2]
master.run_command(['ipa', 'domainlevel-set', '1'])
replica.run_command(['ipactl', 'stop'])
master.run_command(['ipa-replica-manage', 'del', '-f', '-p',
master.config.dirman_password, replica.hostname])
result = master.run_command(['ipa-replica-manage', 'list-ruv',
'-p', master.config.dirman_password])
assert(replica.hostname not in result.stdout_text), (
"Replica's RUV was not properly removed")