URL: https://github.com/freeipa/freeipa/pull/4523
Author: menonsudhir
 Title: #4523: ipatests: Test for ipahealthcheck.ds.ruv check
Action: opened

PR body:
"""
This test ensures that RUVCheck for ipahealthcheck.ds.ruv
source displays correct result


"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/4523/head:pr4523
git checkout pr4523
From 0960ee1c4672d87998ff35eec06b5274bc6807c8 Mon Sep 17 00:00:00 2001
From: sumenon <sume...@redhat.com>
Date: Mon, 13 Apr 2020 17:11:12 +0530
Subject: [PATCH] ipatests: Test for ipahealthcheck.ds.ruv check

This test ensures that RUVCheck for ipahealthcheck.ds.ruv
source displays correct result

Signed-off-by: sumenon <sume...@redhat.com>
---
 .../test_integration/test_ipahealthcheck.py   | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/ipatests/test_integration/test_ipahealthcheck.py b/ipatests/test_integration/test_ipahealthcheck.py
index 327d27413b..9d2d7b0e9c 100644
--- a/ipatests/test_integration/test_ipahealthcheck.py
+++ b/ipatests/test_integration/test_ipahealthcheck.py
@@ -530,6 +530,40 @@ def test_ipa_dns_systemrecords_check(self):
             assert check["result"] == "SUCCESS"
             assert check["kw"]["key"] in SRV_RECORDS
 
+    def test_ipa_healthcheck_ds_ruv_check(self):
+        """
+        This test checks if RUVCheck displays the correct result.
+        """
+        suffix = ipautil.realm_to_suffix(self.master.domain.realm)
+        dn_suffix = escape_dn_chars(str(suffix))
+        conn = self.replicas[0].ldap_connect()
+        entries = conn.get_entries(
+            DN("cn=replica", "cn=" + dn_suffix, "cn=mapping tree, cn=config"),
+            filter="(objectclass=nsds5replicationagreement)",
+            attrs_list=["nsds50ruv"],
+        )
+        assert len(entries) == 1
+        if len(entries) == 1:
+            ruv_data = entries[0]["nsds50ruv"]
+        ruvs = ""
+        for el in ruv_data:
+            ruvs += el
+        replica_id_pattern = re.compile(
+            "\\d\\sldap\\:\\//[a-z]+\\.[a-z]+..........."
+        )
+        replica_id = replica_id_pattern.findall(ruvs)
+        master_ruv = replica_id[0][0]
+        replica_ruv = replica_id[1][0]
+        returncode, data = run_healthcheck(
+            self.master, "ipahealthcheck.ds.ruv", "RUVCheck"
+        )
+        for check in data:
+            assert check["result"] == "SUCCESS"
+        if 'master' in replica_id[0]:
+            assert check["kw"]["ruv"] == master_ruv
+        else:
+            assert check["kw"]["ruv"] == replica_ruv
+
     def test_ipa_healthcheck_output_indent(self):
         """
         This test case checks whether default (2) indentation is applied
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org

Reply via email to