summaryrefslogtreecommitdiffstats
path: root/ipatests
diff options
context:
space:
mode:
authorOleg Fayans <ofayans@redhat.com>2016-10-19 16:50:20 +0200
committerMartin Basti <mbasti@redhat.com>2016-11-10 12:07:24 +0100
commit6d812a0d52ff89dd337aac50c1a107c9dddce73f (patch)
tree6b040a7b0767ed503690c35a275210fd73a913e8 /ipatests
parentb0430b67dc90fddf1e35fde9a0cf2977a07d7cbd (diff)
downloadfreeipa-6d812a0d52ff89dd337aac50c1a107c9dddce73f.tar.gz
freeipa-6d812a0d52ff89dd337aac50c1a107c9dddce73f.tar.xz
freeipa-6d812a0d52ff89dd337aac50c1a107c9dddce73f.zip
tests: Automated clean-ruv subcommand tests
https://fedorahosted.org/freeipa/ticket/6451 Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Milan Kubik <mkubik@redhat.com>
Diffstat (limited to 'ipatests')
-rw-r--r--ipatests/test_integration/test_topology.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/ipatests/test_integration/test_topology.py b/ipatests/test_integration/test_topology.py
index c095812c4..6f02e3206 100644
--- a/ipatests/test_integration/test_topology.py
+++ b/ipatests/test_integration/test_topology.py
@@ -193,3 +193,74 @@ class TestTopologyOptions(IntegrationTest):
assert err == "", err
returncode, error = tasks.destroy_segment(self.master, "%s-to-%s" % replicas)
assert returncode == 0, error
+
+
+@pytest.mark.skipif(config.domain_level == 0, reason=reasoning)
+class TestCASpecificRUVs(IntegrationTest):
+ num_replicas = 2
+ topology = 'star'
+ username = 'testuser'
+ user_firstname = 'test'
+ user_lastname = 'user'
+
+ def test_delete_ruvs(self):
+ """
+ http://www.freeipa.org/page/V4/Manage_replication_topology_4_4/
+ Test_Plan#Test_case:_clean-ruv_subcommand
+ """
+ replica = self.replicas[0]
+ master = self.master
+ res1 = master.run_command(['ipa-replica-manage', 'list-ruv', '-p',
+ master.config.dirman_password])
+ assert(res1.stdout_text.count(replica.hostname) == 2 and
+ "Certificate Server Replica"
+ " Update Vectors" in res1.stdout_text), (
+ "CA-specific RUVs are not displayed")
+ ruvid_re = re.compile(".*%s:389: (\d+).*" % replica.hostname)
+ replica_ruvs = ruvid_re.findall(res1.stdout_text)
+ # Find out the number of RUVids
+ assert(len(replica_ruvs) == 2), (
+ "The output should display 2 RUV ids of the selected replica")
+
+ # Block replication to preserve replica-specific RUVs
+ dashed_domain = master.domain.realm.replace(".", '-')
+ dirsrv_service = "dirsrv@%s.service" % dashed_domain
+ replica.run_command(['systemctl', 'stop', dirsrv_service])
+ try:
+ master.run_command(['ipa-replica-manage', 'clean-ruv',
+ replica_ruvs[1], '-p',
+ master.config.dirman_password, '-f'])
+ res2 = master.run_command(['ipa-replica-manage',
+ 'list-ruv', '-p',
+ master.config.dirman_password])
+
+ assert(res2.stdout_text.count(replica.hostname) == 1), (
+ "CA RUV of the replica is still displayed")
+ master.run_command(['ipa-replica-manage', 'clean-ruv',
+ replica_ruvs[0], '-p',
+ master.config.dirman_password, '-f'])
+ res3 = master.run_command(['ipa-replica-manage', 'list-ruv', '-p',
+ master.config.dirman_password])
+ assert(replica.hostname not in res3.stdout_text), (
+ "replica's RUV is still displayed")
+ finally:
+ replica.run_command(['systemctl', 'start', dirsrv_service])
+
+ def test_replica_uninstall_deletes_ruvs(self):
+ """
+ http://www.freeipa.org/page/V4/Manage_replication_topology_4_4/Test_Plan
+ #Test_case:_.2A-ruv_subcommands_of_ipa-replica-manage_are_extended
+ _to_handle_CA-specific_RUVs
+ """
+ master = self.master
+ replica = self.replicas[1]
+ res1 = master.run_command(['ipa-replica-manage', 'list-ruv', '-p',
+ master.config.dirman_password]).stdout_text
+ assert(res1.count(replica.hostname) == 2), (
+ "Did not find proper number of replica hostname (%s) occurrencies"
+ " in the command output: %s" % (replica.hostname, res1))
+ tasks.uninstall_master(replica)
+ res2 = master.run_command(['ipa-replica-manage', 'list-ruv', '-p',
+ master.config.dirman_password]).stdout_text
+ assert(replica.hostname not in res2), (
+ "Replica RUVs were not clean during replica uninstallation")