On 10/23/2015 03:10 PM, Martin Basti wrote:


On 23.10.2015 15:00, Oleg Fayans wrote:
Hi Martin,

Here comes the updated version.

On 10/22/2015 05:38 PM, Martin Basti wrote:


On 22.10.2015 15:23, Martin Basti wrote:

On 22.10.2015 14:13, Oleg Fayans wrote:




Hello,

thank you for the patch.

1)
please remove the added empty lines, they are unrelated to this ticket

done


2)
-def install_master(host, setup_dns=True, setup_kra=False):
+def install_master(host, setup_dns=True, setup_kra=False,
domainlevel=1):

I suggest to use default domainlevel=None, which will use the default
domain level (specified in build)

done


3)
+    domain_level = domainlevel(master)
I do not think that this meets expectations.

We have to test, both domain level 0 and 1 for IPA 4.3, respectively
new IPA must support all older domain levels, domain level is
independent on IPA version, only admin can raise it up.

So you have to find out way how to pass the domain level for which
test will be running, we were talking about using config files, but
feel free to find something new and better

Fixed. Now, we declare domain level in config.yaml with the directive
domain_level


4)
Did you resolve the pytest fixtures which specifies which tests can be
run under which domain level?

In fact, we do not seem to have any tests yet that would require it.
All the existing tests just use install_replica
 method, no matter how is it done.
How about topology CI test? This can be executed only with domain level

That's right. The topology test was updated. Patch is attached together with a proper version of 11-th patch (not a swap file, sorry about that).

1, right?


5)
+                        '--ip-address', client.ip,

why this change to client install?

Right, it found to be unnecessary.


Martin^2


6)
************* Module ipatests.test_integration.tasks
ipatests/test_integration/tasks.py:85: [E1123(unexpected-keyword-arg),
allow_sync_ptr] Unexpected keyword argument 'raiseonerr' in function
call)

Fixed






--
Oleg Fayans
Quality Engineer
FreeIPA team
RedHat.
From 7a0da0e4220a2e2b0e1475a90c69f9fdcee43210 Mon Sep 17 00:00:00 2001
From: Oleg Fayans <ofay...@redhat.com>
Date: Fri, 23 Oct 2015 14:58:24 +0200
Subject: [PATCH] Updated the tests according to the new replica installation
 workflow

As of 4.3 the replica installation is performed without preparing a gpg file on
master, but rather enrolling a future replica as a client with subsequent
promotion of the client. This required the corresponding change in the
integration tests

https://fedorahosted.org/freeipa/ticket/5379
---
 ipatests/test_integration/config.py          |  3 ++-
 ipatests/test_integration/tasks.py           | 40 +++++++++++++++++++++++-----
 ipatests/test_integration/test_testconfig.py |  4 ++-
 3 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/ipatests/test_integration/config.py b/ipatests/test_integration/config.py
index 785a9bb8c420f99980c098887e0bd31422119564..60a4bd700afe3027dfcbdf203d02373f8a7aa9f9 100644
--- a/ipatests/test_integration/config.py
+++ b/ipatests/test_integration/config.py
@@ -39,6 +39,7 @@ class Config(pytest_multihost.config.Config):
         'ad_admin_name',
         'ad_admin_password',
         'dns_forwarder',
+        'domain_level',
     }
 
     def __init__(self, **kwargs):
@@ -56,7 +57,7 @@ class Config(pytest_multihost.config.Config):
             '%s.pool.ntp.org' % random.randint(0, 3)))
         self.ad_admin_name = kwargs.get('ad_admin_name') or 'Administrator'
         self.ad_admin_password = kwargs.get('ad_admin_password') or 'Secret123'
-
+        self.domain_level = kwargs.get('domain_level')
         # 8.8.8.8 is probably the best-known public DNS
         self.dns_forwarder = kwargs.get('dns_forwarder') or '8.8.8.8'
         self.debug = False
diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index e241454a984aac97eb2d0955f55bb83d85bf9d4c..684edeb04b008d3b9ec1cefe2929a8f6167fccb4 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -79,6 +79,12 @@ def prepare_host(host):
         host.put_file_contents(env_filename, env_to_script(host.to_env()))
 
 
+def allow_sync_ptr(host):
+    kinit_admin(host)
+    host.run_command(["ipa", "dnsconfig-mod", "--allow-sync-ptr=true"],
+                     raiseonerr=False)
+
+
 def apply_common_fixes(host):
     fix_etc_hosts(host)
     fix_hostname(host)
@@ -263,6 +269,9 @@ def install_master(host, setup_dns=True, setup_kra=False):
         '-a', host.config.admin_password
     ]
 
+    if not host.config.domain_level == None:
+        args.append("--domain-level=%i" % host.config.domain_level)
+
     if setup_dns:
         args.extend([
             '--setup-dns',
@@ -288,6 +297,16 @@ def get_replica_filename(replica):
     return os.path.join(replica.config.test_dir, 'replica-info.gpg')
 
 
+def domainlevel(host):
+    result = host.run_command(['ipa', 'domainlevel-get'], raiseonerr=False)
+    level = 0
+    domlevel_re = re.compile('.*(\d)')
+    if result.returncode == 0:
+        # "domainlevel-get" command doesn't exist on ipa versions prior to 4.3
+        level = int(domlevel_re.findall(result.stdout_text)[0])
+    return level
+
+
 def replica_prepare(master, replica):
     apply_common_fixes(replica)
     fix_apache_semaphores(replica)
@@ -306,15 +325,24 @@ def install_replica(master, replica, setup_ca=True, setup_dns=False,
                     setup_kra=False):
     replica.collect_log(paths.IPAREPLICA_INSTALL_LOG)
     replica.collect_log(paths.IPAREPLICA_CONNCHECK_LOG)
-
-    replica_prepare(master, replica)
-
-    replica_filename = get_replica_filename(replica)
+    allow_sync_ptr(master)
+    # Otherwise ipa-client-install would not create a PTR
+    # and replica installation would fail
+    apply_common_fixes(replica)
+    fix_apache_semaphores(replica)
     args = ['ipa-replica-install', '-U',
             '-p', replica.config.dirman_password,
             '-w', replica.config.admin_password,
-            '--ip-address', replica.ip,
-            replica_filename]
+            '--ip-address', replica.ip]
+    if domainlevel(master) == 0:
+        # prepare the replica file on master and put it to replica, AKA "old way"
+	replica_prepare(master, replica)
+        replica_filename = get_replica_filename(replica)
+        args.append(replica_filename)
+    else:
+        # install client on a replica machine and then promote it to replica
+        install_client(master, replica)
+
     if setup_ca:
         args.append('--setup-ca')
     if setup_dns:
diff --git a/ipatests/test_integration/test_testconfig.py b/ipatests/test_integration/test_testconfig.py
index 8d146fcff0dd9729393a30bf45e37c581b528e68..2c69979dbe1bfa1b7e904a56249fb451dad247de 100644
--- a/ipatests/test_integration/test_testconfig.py
+++ b/ipatests/test_integration/test_testconfig.py
@@ -39,7 +39,8 @@ DEFAULT_OUTPUT_DICT = {
     "dirman_dn": "cn=Directory Manager",
     "dirman_password": "Secret123",
     "ntp_server": "ntp.clock.test",
-    "admin_password": "Secret123"
+    "admin_password": "Secret123",
+    "domain_level": "1"
 }
 
 DEFAULT_OUTPUT_ENV = {
@@ -57,6 +58,7 @@ DEFAULT_OUTPUT_ENV = {
     "ADADMINPW": "Secret123",
     "IPv6SETUP": "",
     "IPADEBUG": "",
+    "DOMAINLVL": "1",
 }
 
 DEFAULT_INPUT_ENV = {
-- 
2.4.3

From 1c01b9089f269fc512f4e0d3d4ed6a15a50c112e Mon Sep 17 00:00:00 2001
From: Oleg Fayans <ofay...@redhat.com>
Date: Mon, 26 Oct 2015 08:55:54 +0100
Subject: [PATCH] The test was made to be skipped if domainlevel is 0

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

diff --git a/ipatests/test_integration/test_topology.py b/ipatests/test_integration/test_topology.py
index 0d304fcb3f8736090788a3e1eebff52245155964..2bd134a84b160536ad5804efd8b4325de8bd9252 100644
--- a/ipatests/test_integration/test_topology.py
+++ b/ipatests/test_integration/test_topology.py
@@ -4,11 +4,16 @@
 
 import re
 import time
+import pytest
 
 from ipatests.test_integration.base import IntegrationTest
 from ipatests.test_integration import tasks
+from env_config import get_global_config
 
+config = get_global_config()
+reasoning = "Topology plugin disabled due to domain level 0"
 
+@pytest.mark.skipif(config.domain_level == 0, reason=reasoning)
 class TestTopologyOptions(IntegrationTest):
     num_replicas = 2
     topology = 'star'
-- 
2.4.3

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