URL: https://github.com/freeipa/freeipa/pull/1432
Author: mrizwan93
 Title: #1432: test for nsslapd-ignore-time-skew param of dirsrv in replica 
installation
Action: opened

PR body:
"""
value for nsslapd-ignore-time-skew should remain off by default for  
dirsrv. However while installing replica, it shuold be on. This test
checks that while installing replica, value for nsslapd-ignore-time-skew
set to on and after set to off.

related ticket : https://pagure.io/freeipa/issue/7211

Signed-off-by: Mohammad Rizwan Yusuf <myu...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1432/head:pr1432
git checkout pr1432
From b0e57d8bf3bdea7d0b923303379f60d61a9ca0f8 Mon Sep 17 00:00:00 2001
From: Mohammad Rizwan Yusuf <myu...@redhat.com>
Date: Thu, 4 Jan 2018 15:11:31 +0530
Subject: [PATCH]     value for nsslapd-ignore-time-skew should remain off by
 default for     dirsrv. However while installing replica, it shuold be on.
 This test     checks that while installing replica, value for
 nsslapd-ignore-time-skew     set to on and after set to off.

    related ticket : https://pagure.io/freeipa/issue/7211

Signed-off-by: Mohammad Rizwan Yusuf <myu...@redhat.com>
---
 .../test_integration/test_replica_promotion.py     | 55 ++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py
index 4629d1ff05..3806bef355 100644
--- a/ipatests/test_integration/test_replica_promotion.py
+++ b/ipatests/test_integration/test_replica_promotion.py
@@ -527,3 +527,58 @@ def test_replica_install_with_existing_entry(self):
         master.run_command(arg)
 
         tasks.install_replica(master, replica)
+
+
+class TestNsslapdIgnoreTimeSkew(IntegrationTest):
+    """value for nsslapd-ignore-time-skew should remain off by default for
+    dirsrv. However while installing replica, it shuold be on. This test
+    checks that while installing replica, value for nsslapd-ignore-time-skew
+    set to on and after set to off.
+
+    https://pagure.io/freeipa/issue/7211""";
+
+    num_replicas = 2
+
+    def test_nsslapd_ignore_time_skew(self):
+        master = self.master
+        tasks.install_master(master)
+        replica = self.replicas[0]
+        client = self.replicas[1]
+
+        tasks.install_replica(master, replica)
+        log_file = '/var/log/ipareplica-install.log'
+        replica_install_log = replica.get_file_contents(log_file)
+        regex = '^.*nsslapd\-ignore\-time\-skew:\n(.*)$'
+        occ_list = re.findall(regex, replica_install_log, re.M)
+        assert 'on' in occ_list[0] and 'off' in occ_list[1]
+
+        # check on replica promotion
+        tasks.install_client(master, client)
+        args = ['ipa-replica-install', '-U',
+                '-p', master.config.dirman_password,
+                '-w', master.config.admin_password,
+                '--ip-address', client.ip]
+        result = client.run_command(args)
+        assert result.returncode == 0
+
+        replica_install_log = client.get_file_contents(log_file)
+        occ_list = re.findall(regex, replica_install_log, re.M)
+        assert 'on' in occ_list[0] and 'off' in occ_list[1]
+
+        # check if nsslapd-ignore-time-skew is set to off for disrv
+        arg = ['ldapsearch', '-D',
+               str(replica.config.dirman_dn),   # pylint: disable=no-member
+               '-w', replica.config.dirman_password,
+               '-h', replica.hostname,
+               '-b', 'cn=config']
+        result = replica.run_command(arg)
+        assert "nsslapd-ignore-time-skew: off" in result.stdout_text
+
+        # check on client promoted to replica
+        arg = ['ldapsearch', '-D',
+               str(replica.config.dirman_dn),   # pylint: disable=no-member
+               '-w', replica.config.dirman_password,
+               '-h', replica.hostname,
+               '-b', 'cn=config']
+        result = client.run_command(arg)
+        assert "nsslapd-ignore-time-skew: off" in result.stdout_text
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to