On 07.12.2015 15:51, Oleg Fayans wrote:

On 12/07/2015 03:51 PM, Martin Basti wrote:

On 07.12.2015 15:49, Oleg Fayans wrote:
Hi,

On 12/07/2015 02:37 PM, Martin Basti wrote:
On 07.12.2015 14:32, Martin Basti wrote:
On 07.12.2015 13:24, Oleg Fayans wrote:
Hi Martin,

I would prefer both install_kra and install_ca methods to have
raiseonerr parameter set to True by default. We need a way to test
negatives and analyze results.
Mine looks like this:

def install_kra(host, domain_level=None,
                   first_instance=False, raiseonerr=True):
       if not domain_level:
          domain_level = host.config.domain_level
       command = ["ipa-kra-install", "-U", "-p",
host.config.dirman_password]
       if domain_level == DOMAIN_LEVEL_0 and not first_instance:
           replica_file = get_replica_filename(host)
           command.append(replica_file)
       return host.run_command(command, raiseonerr=raiseonerr)

The rest looks good to me, but I did not run the tests yet.
Sounds good, I will amend the patche later.
I changed my mind, should not be the domain_level value get from
function domainlevel(host)?
We should have a way to test negatives, like providing replica file at
domain level=1 and not providing at domain level=0. So these functions
should either accept replica file as a parameter, or arbitrary domain
level
Agree, but I meant this

      if not domain_level:
-        domain_level = host.config.domain_level
+        domain_level = domainlevel(host)
Oh, yes, you are right, that's better.


Martin^2

On 12/06/2015 10:22 PM, Martin Basti wrote:
My favorite today \o/ --> 67 <-- \o/ test cases, no more manual
testing
of installers \o/.

Test suite contains: 6 combination how to install components on
replica
X 4 combinations of server installation + 3 extra server tests

To save time tests install 1 master and 3 replicas per test class
(except extra server tests):
Class name  specifies what is installed on master.

Remember, option "-k" is your friend
$ ipa-run-tests -k '<name of class you want to test (it is regexp)>'
otherwise you will need a lot of time until tests finish.

To list all tests:
$ ipa-run-tests test_integration/test_installation.py --collect-only


Patch attached, it needs to have attached all patches I sent today
and
also attached workaround patch (Martin3 will provide proper fix)

I haven't had time/mood/resources to test this patch with domain
level
0, so testing this patch with domain level 0 is appreciated.


Oleg, I added some methods to tasks.py which you may want to reuse.

Martin^2

Updated patch attached.

Still some tests are failing, not sure if it is test issue or bugs. I will test later.
From 77b7e638890b202689682691ba33874df34ceba0 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Fri, 4 Dec 2015 17:12:05 +0100
Subject: [PATCH] CI: installation tests

---
 ipatests/test_integration/tasks.py             |  32 ++++
 ipatests/test_integration/test_installation.py | 200 +++++++++++++++++++++++++
 2 files changed, 232 insertions(+)
 create mode 100644 ipatests/test_integration/test_installation.py

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index a0d599d52d4edb9471b6a0cedd155a8590d0889b..f1b71d274087f3c837a0542e7a3b0b98adab99f0 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -39,6 +39,7 @@ from ipatests.test_integration.env_config import env_to_script
 from ipatests.test_integration.host import Host
 from ipalib.util import get_reverse_zone_default
 from ipalib.constants import DOMAIN_SUFFIX_NAME
+from ipalib.constants import DOMAIN_LEVEL_0
 
 log = log_mgr.get_logger(__name__)
 
@@ -924,3 +925,34 @@ def resolve_record(nameserver, query, rtype="SOA", retry=True, timeout=100):
             if not retry:
                 raise
         time.sleep(1)
+
+
+def install_kra(host, domain_level=None, first_instance=False, raiseonerr=True):
+    if not domain_level:
+       domain_level = domainlevel(host)
+    command = ["ipa-kra-install", "-U", "-p", host.config.dirman_password]
+    if domain_level == DOMAIN_LEVEL_0 and not first_instance:
+        replica_file = get_replica_filename(host)
+        command.append(replica_file)
+    return host.run_command(command, raiseonerr=raiseonerr)
+
+
+def install_ca(host, domain_level=None, first_instance=False, raiseonerr=True):
+    if not domain_level:
+       domain_level = domainlevel(host)
+    command = ["ipa-ca-install", "-U", "-p", host.config.dirman_password,
+               "-P", 'admin', "-w", host.config.admin_password]
+    if domain_level == DOMAIN_LEVEL_0 and not first_instance:
+        replica_file = get_replica_filename(host)
+        command.append(replica_file)
+    return host.run_command(command, raiseonerr=raiseonerr)
+
+
+def install_dns(host, raiseonerr=True):
+    args = [
+        "ipa-dns-install",
+        "--forwarder", host.config.dns_forwarder,
+        "-p", host.config.dirman_password,
+        "-U",
+    ]
+    return host.run_command(args, raiseonerr=raiseonerr)
diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py
new file mode 100644
index 0000000000000000000000000000000000000000..925cc7d835ac8563efa98ab8ac33727052ac1f81
--- /dev/null
+++ b/ipatests/test_integration/test_installation.py
@@ -0,0 +1,200 @@
+#
+# Copyright (C) 2015  FreeIPA Contributors see COPYING for license
+#
+
+"""
+Module provides tests which testing ability of various subsystems to be
+installed.
+"""
+
+import time
+
+from ipatests.test_integration.base import IntegrationTest
+from ipatests.test_integration import tasks
+
+
+class InstallTestBase1(IntegrationTest):
+
+    num_replicas = 3
+    topology = 'star'
+
+    @classmethod
+    def install(cls, mh):
+        tasks.install_master(cls.master, setup_dns=False)
+
+    def test_replica0_ca_less_install(self):
+        tasks.install_replica(self.master, self.replicas[0], setup_ca=False)
+
+    def test_replica0_ipa_ca_install(self):
+        tasks.install_ca(self.replicas[0])
+
+    def test_replica0_ipa_kra_install(self):
+        tasks.install_kra(self.replicas[0], first_instance=True)
+
+    def test_replica0_ipa_dns_install(self):
+        tasks.install_dns(self.replicas[0])
+
+    def test_replica1_with_ca_install(self):
+        tasks.install_replica(self.master, self.replicas[1], setup_ca=True)
+
+    def test_replica1_ipa_kra_install(self):
+        tasks.install_kra(self.replicas[1])
+
+    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
+    topology = 'star'
+
+    @classmethod
+    def install(cls, mh):
+        tasks.install_master(cls.master, setup_dns=False)
+
+    def test_replica0_with_ca_kra_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_replica2_with_dns_install(self):
+        tasks.install_replica(self.master, self.replicas[2], setup_ca=False,
+                              setup_dns=True)
+
+    def test_replica2_ipa_ca_install(self):
+        tasks.install_ca(self.replicas[2])
+
+    def test_replica2_ipa_kra_install(self):
+        tasks.install_kra(self.replicas[2])
+
+
+##
+# Master X Replicas installation tests
+##
+
+class TestInstallWithCA1(InstallTestBase1):
+
+    @classmethod
+    def install(cls, mh):
+        tasks.install_master(cls.master, setup_dns=False)
+
+
+class TestInstallWithCA2(InstallTestBase2):
+
+    @classmethod
+    def install(cls, mh):
+        tasks.install_master(cls.master, setup_dns=False)
+
+
+class TestInstallWithCA_KRA1(InstallTestBase1):
+
+    @classmethod
+    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_KRA2(InstallTestBase2):
+
+    @classmethod
+    def install(cls, mh):
+        tasks.install_master(cls.master, setup_dns=False, setup_kra=True)
+
+
+class TestInstallWithCA_DNS1(InstallTestBase1):
+
+    @classmethod
+    def install(cls, mh):
+        tasks.install_master(cls.master, setup_dns=True)
+
+
+class TestInstallWithCA_DNS2(InstallTestBase2):
+
+    @classmethod
+    def install(cls, mh):
+        tasks.install_master(cls.master, setup_dns=True)
+
+
+class TestInstallWithCA_KRA_DNS1(InstallTestBase1):
+
+    @classmethod
+    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)
+
+
+class TestInstallWithCA_KRA_DNS2(InstallTestBase2):
+
+    @classmethod
+    def install(cls, mh):
+        tasks.install_master(cls.master, setup_dns=True, setup_kra=True)
+
+
+##
+# Rest of master installation tests
+##
+
+class TestInstallMaster(IntegrationTest):
+
+    num_replicas = 0
+
+    @classmethod
+    def install(cls, mh):
+        pass
+
+    def test_install_master(self):
+        tasks.install_master(self.master, setup_dns=False)
+
+    def test_install_kra(self):
+        tasks.install_kra(self.master, first_instance=True)
+
+    def test_install_dns(self):
+        tasks.install_dns(self.master)
+
+
+class TestInstallMasterKRA(IntegrationTest):
+
+    num_replicas = 0
+
+    @classmethod
+    def install(cls, mh):
+        pass
+
+    def test_install_master(self):
+        tasks.install_master(self.master, setup_dns=False, setup_kra=True)
+
+    def test_install_dns(self):
+        tasks.install_dns(self.master)
+
+
+class TestInstallMasterDNS(IntegrationTest):
+
+    num_replicas = 0
+
+    @classmethod
+    def install(cls, mh):
+        pass
+
+    def test_install_master(self):
+        tasks.install_master(self.master, setup_dns=True)
+
+    def test_install_kra(self):
+        tasks.install_kra(self.master, first_instance=True)
-- 
2.5.0

-- 
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