One more test was added to the patch-0048

On 06/17/2016 09:43 AM, Oleg Fayans wrote:
> Fixed a bug in the previous patch, automated 2 more testcases from
> http://www.freeipa.org/page/V4/Manage_replication_topology_4_4/Test_Plan
> 
> On 06/16/2016 04:46 PM, Oleg Fayans wrote:
>>
>>
>>
> 
> 
> 

-- 
Oleg Fayans
Quality Engineer
FreeIPA team
RedHat.
From 06cfa465895851c0f41d581ea43e345ef07b54c3 Mon Sep 17 00:00:00 2001
From: Oleg Fayans <ofay...@redhat.com>
Date: Fri, 17 Jun 2016 11:17:05 +0200
Subject: [PATCH] Automated ipa-replica-manage del tests

---
 ipatests/test_integration/test_topology.py | 74 ++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)

diff --git a/ipatests/test_integration/test_topology.py b/ipatests/test_integration/test_topology.py
index 7a7bbfa579731410d147791d73a9e07b0fd1b271..b5deb8b9e1bb713fe6642de1de89656ac1be8605 100644
--- a/ipatests/test_integration/test_topology.py
+++ b/ipatests/test_integration/test_topology.py
@@ -5,6 +5,7 @@
 import re
 
 import pytest
+import time
 
 from ipatests.test_integration.base import IntegrationTest
 from ipatests.test_integration import tasks
@@ -207,3 +208,76 @@ class TestCASpecificRUVs(IntegrationTest):
                                       raiseonerr=False)
         assert(result6.returncode > 0), (
             'Replication still works after all RUVs were deleted')
+
+
+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(['poweroff'])
+        time.sleep(3)
+        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])
+        assert(replica.hostname in 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])
+        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(['poweroff'])
+        time.sleep(3)
+        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")
-- 
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