URL: https://github.com/freeipa/freeipa/pull/136
Author: mbasti-rh
 Title: #136: [WIP] Fix KRA install tests
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/136/head:pr136
git checkout pr136
From 54f15f3f9eb7f7be276834c92802f72fa5b42454 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Tue, 4 Oct 2016 22:30:00 +0200
Subject: [PATCH 1/3] CI: remove duplicated install tests

KRA cannot be installed in one step with ipa-replica-install, we dropped
this support.

This commit removes duplicated test-cases

https://fedorahosted.org/freeipa/ticket/6088
---
 ipatests/test_integration/test_installation.py | 33 +++++++++-----------------
 1 file changed, 11 insertions(+), 22 deletions(-)

diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py
index c3d194f..819ede4 100644
--- a/ipatests/test_integration/test_installation.py
+++ b/ipatests/test_integration/test_installation.py
@@ -13,7 +13,7 @@
 
 class InstallTestBase1(IntegrationTest):
 
-    num_replicas = 3
+    num_replicas = 2
     topology = 'star'
 
     @classmethod
@@ -41,43 +41,32 @@ def test_replica1_ipa_kra_install(self):
     def test_replica1_ipa_dns_install(self):
         tasks.install_dns(self.replicas[1])
 
-    def test_replica2_with_ca_kra_install(self):
-        tasks.install_replica(self.master, self.replicas[2], setup_ca=True,
-                              setup_kra=True)
-
-    def test_replica2_ipa_dns_install(self):
-        tasks.install_dns(self.replicas[2])
-
 
 class InstallTestBase2(IntegrationTest):
 
-    num_replicas = 3
+    num_replicas = 2
     topology = 'star'
 
     @classmethod
     def install(cls, mh):
         tasks.install_master(cls.master, setup_dns=False)
 
-    def test_replica0_with_ca_kra_dns_install(self):
+    def test_replica0_with_ca_dns_install(self):
         tasks.install_replica(self.master, self.replicas[0], setup_ca=True,
-                              setup_kra=True, setup_dns=True)
-
-    def test_replica1_with_ca_dns_install(self):
-        tasks.install_replica(self.master, self.replicas[1], setup_ca=True,
                               setup_dns=True)
 
-    def test_replica1_ipa_kra_install(self):
-        tasks.install_kra(self.replicas[1])
+    def test_replica0_ipa_kra_install(self):
+        tasks.install_kra(self.replicas[0])
 
-    def test_replica2_with_dns_install(self):
-        tasks.install_replica(self.master, self.replicas[2], setup_ca=False,
+    def test_replica1_with_dns_install(self):
+        tasks.install_replica(self.master, self.replicas[1], setup_ca=False,
                               setup_dns=True)
 
-    def test_replica2_ipa_ca_install(self):
-        tasks.install_ca(self.replicas[2])
+    def test_replica1_ipa_ca_install(self):
+        tasks.install_ca(self.replicas[1])
 
-    def test_replica2_ipa_kra_install(self):
-        tasks.install_kra(self.replicas[2])
+    def test_replica1_ipa_kra_install(self):
+        tasks.install_kra(self.replicas[1])
 
 
 ##

From 93db2b8b515f93d34c126d33aaf3d0fd2b374978 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Tue, 4 Oct 2016 22:46:03 +0200
Subject: [PATCH 2/3] CI installation: skip KRA on replica with domain lvl 0

With domain level 0, replica requires to have KRA installed on original
server (source of replica file)

https://fedorahosted.org/freeipa/ticket/6088
---
 ipatests/test_integration/test_installation.py | 42 ++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py
index 819ede4..a27388b 100644
--- a/ipatests/test_integration/test_installation.py
+++ b/ipatests/test_integration/test_installation.py
@@ -6,10 +6,14 @@
 Module provides tests which testing ability of various subsystems to be
 installed.
 """
-
+import pytest
+from ipalib.constants import DOMAIN_LEVEL_0
+from ipatests.test_integration.env_config import get_global_config
 from ipatests.test_integration.base import IntegrationTest
 from ipatests.test_integration import tasks
 
+config = get_global_config()
+
 
 class InstallTestBase1(IntegrationTest):
 
@@ -56,7 +60,7 @@ def test_replica0_with_ca_dns_install(self):
                               setup_dns=True)
 
     def test_replica0_ipa_kra_install(self):
-        tasks.install_kra(self.replicas[0])
+        tasks.install_kra(self.replicas[0], first_instance=True)
 
     def test_replica1_with_dns_install(self):
         tasks.install_replica(self.master, self.replicas[1], setup_ca=False,
@@ -79,6 +83,13 @@ class TestInstallWithCA1(InstallTestBase1):
     def install(cls, mh):
         tasks.install_master(cls.master, setup_dns=False)
 
+    @pytest.mark.skipif(
+        config.domain_level == DOMAIN_LEVEL_0,
+        reason='does not work on DOMAIN_LEVEL_0 by design (KRA requires to '
+               'have KRA installed on original server)')
+    def test_replica1_ipa_kra_install(self):
+        super(TestInstallWithCA1, self).test_replica1_ipa_kra_install()
+
 
 class TestInstallWithCA2(InstallTestBase2):
 
@@ -86,6 +97,13 @@ class TestInstallWithCA2(InstallTestBase2):
     def install(cls, mh):
         tasks.install_master(cls.master, setup_dns=False)
 
+    @pytest.mark.skipif(
+        config.domain_level == DOMAIN_LEVEL_0,
+        reason='does not work on DOMAIN_LEVEL_0 by design (KRA requires to '
+               'have KRA installed on original server)')
+    def test_replica1_ipa_kra_install(self):
+        super(TestInstallWithCA2, self).test_replica1_ipa_kra_install()
+
 
 class TestInstallWithCA_KRA1(InstallTestBase1):
 
@@ -103,6 +121,9 @@ class TestInstallWithCA_KRA2(InstallTestBase2):
     def install(cls, mh):
         tasks.install_master(cls.master, setup_dns=False, setup_kra=True)
 
+    def test_replica0_ipa_kra_install(self):
+        tasks.install_kra(self.replicas[0], first_instance=False)
+
 
 class TestInstallWithCA_DNS1(InstallTestBase1):
 
@@ -110,6 +131,13 @@ class TestInstallWithCA_DNS1(InstallTestBase1):
     def install(cls, mh):
         tasks.install_master(cls.master, setup_dns=True)
 
+    @pytest.mark.skipif(
+        config.domain_level == DOMAIN_LEVEL_0,
+        reason='does not work on DOMAIN_LEVEL_0 by design (KRA requires to '
+               'have KRA installed on original server)')
+    def test_replica1_ipa_kra_install(self):
+        super(TestInstallWithCA_DNS1, self).test_replica1_ipa_kra_install()
+
 
 class TestInstallWithCA_DNS2(InstallTestBase2):
 
@@ -117,6 +145,13 @@ class TestInstallWithCA_DNS2(InstallTestBase2):
     def install(cls, mh):
         tasks.install_master(cls.master, setup_dns=True)
 
+    @pytest.mark.skipif(
+        config.domain_level == DOMAIN_LEVEL_0,
+        reason='does not work on DOMAIN_LEVEL_0 by design (KRA requires to '
+               'have KRA installed on original server)')
+    def test_replica1_ipa_kra_install(self):
+        super(TestInstallWithCA_DNS2, self).test_replica1_ipa_kra_install()
+
 
 class TestInstallWithCA_KRA_DNS1(InstallTestBase1):
 
@@ -134,6 +169,9 @@ class TestInstallWithCA_KRA_DNS2(InstallTestBase2):
     def install(cls, mh):
         tasks.install_master(cls.master, setup_dns=True, setup_kra=True)
 
+    def test_replica0_ipa_kra_install(self):
+        tasks.install_kra(self.replicas[0], first_instance=False)
+
 
 ##
 # Rest of master installation tests

From fba258f15e5ac5a2070d4c0365c05e9fe9b39dc4 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Tue, 4 Oct 2016 23:08:19 +0200
Subject: [PATCH 3/3] CI: extend replication layouts tests with KRA

KRA should be tested with warious replication topologies as well, mainly
in domain level 0

https://fedorahosted.org/freeipa/ticket/6088
---
 ipatests/test_integration/tasks.py                 | 18 ++++++--
 .../test_integration/test_replication_layouts.py   | 48 ++++++++++++++++++++++
 2 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index 6c26626..c31a338 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -994,12 +994,20 @@ def double_circle_topo(master, replicas, site_size=6):
 
 
 def install_topo(topo, master, replicas, clients, domain_level=None,
-                 skip_master=False, setup_replica_cas=True):
+                 skip_master=False, setup_replica_cas=True,
+                 setup_replica_kras=False):
     """Install IPA servers and clients in the given topology"""
+    if setup_replica_kras and not setup_replica_cas:
+        raise ValueError("Option 'setup_replica_kras' requires "
+                         "'setup_replica_cas' set to True")
     replicas = list(replicas)
     installed = {master}
     if not skip_master:
-        install_master(master, domain_level=domain_level)
+        install_master(
+            master,
+            domain_level=domain_level,
+            setup_kra=setup_replica_kras
+        )
 
     add_a_records_for_hosts_in_master_domain(master)
 
@@ -1009,7 +1017,11 @@ def install_topo(topo, master, replicas, clients, domain_level=None,
             connect_replica(parent, child)
         else:
             log.info('Installing replica %s from %s' % (parent, child))
-            install_replica(parent, child, setup_ca=setup_replica_cas)
+            install_replica(
+                parent, child,
+                setup_ca=setup_replica_cas,
+                setup_kra=setup_replica_kras
+            )
         installed.add(child)
     install_clients([master] + replicas, clients)
 
diff --git a/ipatests/test_integration/test_replication_layouts.py b/ipatests/test_integration/test_replication_layouts.py
index c178815..53cae7d 100644
--- a/ipatests/test_integration/test_replication_layouts.py
+++ b/ipatests/test_integration/test_replication_layouts.py
@@ -52,6 +52,16 @@ def test_line_topology_with_ca(self):
         self.replication_is_working()
 
 
+class TestLineTopologyWithCAKRA(LayoutsBaseTest):
+
+    num_replicas = 3
+
+    def test_line_topology_with_ca_kra(self):
+        tasks.install_topo('line', self.master, self.replicas, [],
+                           setup_replica_cas=True, setup_replica_kras=True)
+        self.replication_is_working()
+
+
 class TestStarTopologyWithoutCA(LayoutsBaseTest):
 
     num_replicas = 3
@@ -72,6 +82,16 @@ def test_star_topology_with_ca(self):
         self.replication_is_working()
 
 
+class TestStarTopologyWithCAKRA(LayoutsBaseTest):
+
+    num_replicas = 3
+
+    def test_star_topology_with_ca_kra(self):
+        tasks.install_topo('star', self.master, self.replicas, [],
+                           setup_replica_cas=True, setup_replica_kras=True)
+        self.replication_is_working()
+
+
 class TestCompleteTopologyWithoutCA(LayoutsBaseTest):
 
     num_replicas = 3
@@ -92,6 +112,16 @@ def test_complete_topology_with_ca(self):
         self.replication_is_working()
 
 
+class TestCompleteTopologyWithCAKRA(LayoutsBaseTest):
+
+    num_replicas = 3
+
+    def test_complete_topology_with_ca_kra(self):
+        tasks.install_topo('complete', self.master, self.replicas, [],
+                           setup_replica_cas=True, setup_replica_kras=True)
+        self.replication_is_working()
+
+
 @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
                     reason='does not work on DOMAIN_LEVEL_0 by design')
 class Test2ConnectedTopologyWithoutCA(LayoutsBaseTest):
@@ -112,6 +142,15 @@ def test_2_connected_topology_with_ca(self):
         self.replication_is_working()
 
 
+class Test2ConnectedTopologyWithCAKRA(LayoutsBaseTest):
+    num_replicas = 33
+
+    def test_2_connected_topology_with_ca_kra(self):
+        tasks.install_topo('2-connected', self.master, self.replicas, [],
+                           setup_replica_cas=True, setup_replica_kras=True)
+        self.replication_is_working()
+
+
 @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
                     reason='does not work on DOMAIN_LEVEL_0 by design')
 class TestDoubleCircleTopologyWithoutCA(LayoutsBaseTest):
@@ -130,3 +169,12 @@ def test_2_connected_topology_with_ca(self):
         tasks.install_topo('double-circle', self.master, self.replicas, [],
                            setup_replica_cas=True)
         self.replication_is_working()
+
+
+class TestDoubleCircleTopologyWithCAKRA(LayoutsBaseTest):
+    num_replicas = 29
+
+    def test_2_connected_topology_with_ca_kra(self):
+        tasks.install_topo('double-circle', self.master, self.replicas, [],
+                           setup_replica_cas=True, setup_replica_kras=True)
+        self.replication_is_working()
-- 
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