-- 
Oleg Fayans
Quality Engineer
FreeIPA team
RedHat.
From debac0cf5cb24e1c2072d10373f4d9f72cb875a7 Mon Sep 17 00:00:00 2001
From: Oleg Fayans <ofay...@redhat.com>
Date: Thu, 16 Jun 2016 16:45:03 +0200
Subject: [PATCH] Automated clean-ruv subcommand test

https://fedorahosted.org/freeipa/ticket/5964
---
 ipatests/test_integration/test_topology.py | 51 ++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/ipatests/test_integration/test_topology.py b/ipatests/test_integration/test_topology.py
index e956563c27eafd84deed5786274a73d0d3594642..849ee12267b2f0412dee189440c2fe7bd0cdec85 100644
--- a/ipatests/test_integration/test_topology.py
+++ b/ipatests/test_integration/test_topology.py
@@ -159,3 +159,54 @@ 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 = 1
+    topology = 'star'
+    username = 'testuser'
+    user_firstname = 'test'
+    user_lastname = 'user'
+
+    def test_ca_specific_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
+        """
+        replica = self.replicas[0]
+        master = self.master
+        result1 = master.run_command(['ipa-replica-manage', 'list-ruv',
+                                      '-p', master.config.dirman_password])
+        assert(result1.stdout_text.count(replica.hostname) == 2 and
+               "Certificate Server Replica Update Vectors" in result1.stdout_text), (
+            "CA-specific RUVs are not displayed")
+        ruvid_re = re.compile(".*%s:389: (\d+).*" % replica)
+        replica_ruv_ids = ruvid_re.findall(result1.stdout_text)
+        result2 = master.run_command(['ipa-replica-manage', 'clean-ruv',
+                                      replica_ruv_ids[1], '-p',
+                                      master.config.dirman_password, '-f'])
+        assert(replica.hostname in result2.stdout_text), (
+            "The wrong RUV was deleted")
+        result3 = master.run_command(['ipa-replica-manage', 'list-ruv',
+                                      '-p', master.config.dirman_password])
+        assert(result3.stdout_text.count(replica.hostname) == 1), (
+            "CA RUV of the replica is still displayed")
+        result4 = master.run_command(['ipa-replica-manage', 'clean-ruv',
+                                      replica_ruv_ids[0], '-p',
+                                      master.config.dirman_password, '-f'])
+        assert(replica.hostname in result4.stdout_text), (
+            "The wrong RUV was deleted")
+        result5 = master.run_command(['ipa-replica-manage', 'list-ruv',
+                                      '-p', master.config.dirman_password])
+        assert(replica.hostname not in result5.stdout_text), (
+            "replica's RUV is still displayed")
+        tasks.kinit_admin(master)
+        master.run_command(['ipa', 'user-add', self.username,
+                            "--first=%s" % self.user_firstname,
+                            "--last=%s" % self.user_lastname])
+        result6 = replica.run_command(['ipa', 'user-show', self.username],
+                                      raiseonerr=False)
+        assert(result6.returncode > 0), (
+            'Replication still works after all RUVs were deleted')
-- 
1.8.3.1

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to