URL: https://github.com/freeipa/freeipa/pull/136
Author: mbasti-rh
 Title: #136: 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 4bc794329399344cd2218f71c408d096b2fc2f93 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Tue, 4 Oct 2016 23:08:19 +0200
Subject: [PATCH 1/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 0b460b9..ef5078b 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()

From 052c3e9e4ffb46665217ea6f4deb58528333570d Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Tue, 11 Oct 2016 18:33:08 +0200
Subject: [PATCH 2/3] CI: use --setup-kra with replica installation

Currently tests were not testing one-step installation of KRA together
with replica. Adding --setup-kra to replica installation instead of
calling ipa-kra-install after.

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

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index ef5078b..df5e408 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -359,6 +359,9 @@ def install_replica(master, replica, setup_ca=True, setup_dns=False,
         args.append('-U')
     if setup_ca:
         args.append('--setup-ca')
+    if setup_kra:
+        assert setup_ca, "CA must be installed on replica with KRA"
+        args.append('--setup-kra')
     if setup_dns:
         args.extend([
             '--setup-dns',
@@ -388,17 +391,6 @@ def install_replica(master, replica, setup_ca=True, setup_dns=False,
     if result.returncode == 0:
         enable_replication_debugging(replica)
         setup_sssd_debugging(replica)
-        if setup_kra:
-            assert setup_ca, "CA must be installed on replica with KRA"
-            args = [
-                "ipa-kra-install",
-                "-p", replica.config.dirman_password,
-                "-U",
-            ]
-            if domainlevel(master) == DOMAIN_LEVEL_0:
-                args.append(replica_filename)
-            replica.run_command(args)
-
         kinit_admin(replica)
     return result
 

From 1d6ab3bbed152d57f9f0fa323c3872fbf6c0546f Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Thu, 13 Oct 2016 17:42:27 +0200
Subject: [PATCH 3/3] CI: Disable KRA install tests on DL0

When master is without KRA installed, on domain level0 we cannot install
KRA replicas, thus this tests must be skipped on DL0

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

diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py
index c3d194f..ccc356f 100644
--- a/ipatests/test_integration/test_installation.py
+++ b/ipatests/test_integration/test_installation.py
@@ -7,9 +7,13 @@
 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):
 
@@ -90,6 +94,21 @@ 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')
+    def test_replica1_ipa_kra_install(self):
+        super(TestInstallWithCA1, self).test_replica1_ipa_kra_install()
+
+    @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
+                        reason='does not work on DOMAIN_LEVEL_0 by design')
+    def test_replica2_with_ca_kra_install(self):
+        super(TestInstallWithCA1, self).test_replica2_with_ca_kra_install()
+
+    @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
+                        reason='does not work on DOMAIN_LEVEL_0 by design')
+    def test_replica2_ipa_dns_install(self):
+        super(TestInstallWithCA1, self).test_replica2_ipa_dns_install()
+
 
 class TestInstallWithCA2(InstallTestBase2):
 
@@ -97,6 +116,21 @@ 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')
+    def test_replica0_with_ca_kra_dns_install(self):
+        super(TestInstallWithCA2, self).test_replica0_with_ca_kra_dns_install()
+
+    @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
+                        reason='does not work on DOMAIN_LEVEL_0 by design')
+    def test_replica1_ipa_kra_install(self):
+        super(TestInstallWithCA2, self).test_replica1_ipa_kra_install()
+
+    @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
+                        reason='does not work on DOMAIN_LEVEL_0 by design')
+    def test_replica2_ipa_kra_install(self):
+        super(TestInstallWithCA2, self).test_replica2_ipa_kra_install()
+
 
 class TestInstallWithCA_KRA1(InstallTestBase1):
 
@@ -121,6 +155,21 @@ 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')
+    def test_replica1_ipa_kra_install(self):
+        super(TestInstallWithCA_DNS1, self).test_replica1_ipa_kra_install()
+
+    @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
+                        reason='does not work on DOMAIN_LEVEL_0 by design')
+    def test_replica2_with_ca_kra_install(self):
+        super(TestInstallWithCA_DNS1, self).test_replica2_with_ca_kra_install()
+
+    @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
+                        reason='does not work on DOMAIN_LEVEL_0 by design')
+    def test_replica2_ipa_dns_install(self):
+        super(TestInstallWithCA_DNS1, self).test_replica2_ipa_dns_install()
+
 
 class TestInstallWithCA_DNS2(InstallTestBase2):
 
@@ -128,6 +177,23 @@ 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')
+    def test_replica0_with_ca_kra_dns_install(self):
+        super(
+            TestInstallWithCA_DNS2, self
+        ).test_replica0_with_ca_kra_dns_install()
+
+    @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
+                        reason='does not work on DOMAIN_LEVEL_0 by design')
+    def test_replica1_ipa_kra_install(self):
+        super(TestInstallWithCA_DNS2, self).test_replica1_ipa_kra_install()
+
+    @pytest.mark.skipif(config.domain_level == DOMAIN_LEVEL_0,
+                        reason='does not work on DOMAIN_LEVEL_0 by design')
+    def test_replica2_ipa_kra_install(self):
+        super(TestInstallWithCA_DNS2, self).test_replica2_ipa_kra_install()
+
 
 class TestInstallWithCA_KRA_DNS1(InstallTestBase1):
 
-- 
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