7e1b55
From b6ab27acdb07c21f43e9dcc9b777f8fd6a8925e1 Mon Sep 17 00:00:00 2001
7e1b55
From: Christian Heimes <cheimes@redhat.com>
7e1b55
Date: Fri, 18 Jun 2021 10:51:54 +0200
7e1b55
Subject: [PATCH] Test DNA plugin configuration
7e1b55
7e1b55
Reviewed-By: Francois Cami <fcami@redhat.com>
7e1b55
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
7e1b55
Reviewed-By: Francois Cami <fcami@redhat.com>
7e1b55
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
7e1b55
---
7e1b55
 ipatests/test_integration/test_subids.py | 22 +++++++++++++++++++++-
7e1b55
 1 file changed, 21 insertions(+), 1 deletion(-)
7e1b55
7e1b55
diff --git a/ipatests/test_integration/test_subids.py b/ipatests/test_integration/test_subids.py
7e1b55
index 48e58c26464f52605438afe865575e5ca4c8f1f8..28cd1f765cd63af944bce83f4676a2b1998f5f5d 100644
7e1b55
--- a/ipatests/test_integration/test_subids.py
7e1b55
+++ b/ipatests/test_integration/test_subids.py
7e1b55
@@ -6,8 +6,11 @@
7e1b55
 """
7e1b55
 import os
7e1b55
 
7e1b55
-from ipalib.constants import SUBID_COUNT, SUBID_RANGE_START, SUBID_RANGE_MAX
7e1b55
+from ipalib.constants import (
7e1b55
+    SUBID_COUNT, SUBID_RANGE_START, SUBID_RANGE_MAX, SUBID_DNA_THRESHOLD
7e1b55
+)
7e1b55
 from ipaplatform.paths import paths
7e1b55
+from ipapython.dn import DN
7e1b55
 from ipatests.pytest_ipa.integration import tasks
7e1b55
 from ipatests.test_integration.base import IntegrationTest
7e1b55
 
7e1b55
@@ -81,6 +84,23 @@ class TestSubordinateId(IntegrationTest):
7e1b55
             cmd.extend(("--owner", uid))
7e1b55
         return self.master.run_command(cmd, **kwargs)
7e1b55
 
7e1b55
+    def test_dna_config(self):
7e1b55
+        conn = self.master.ldap_connect()
7e1b55
+        dna_cfg = DN(
7e1b55
+            "cn=Subordinate IDs,cn=Distributed Numeric Assignment Plugin,"
7e1b55
+            "cn=plugins,cn=config"
7e1b55
+        )
7e1b55
+        entry = conn.get_entry(dna_cfg)
7e1b55
+
7e1b55
+        def single_int(key):
7e1b55
+            return int(entry.single_value[key])
7e1b55
+
7e1b55
+        assert single_int("dnaInterval") == SUBID_COUNT
7e1b55
+        assert single_int("dnaThreshold") == SUBID_DNA_THRESHOLD
7e1b55
+        assert single_int("dnaMagicRegen") == -1
7e1b55
+        assert single_int("dnaMaxValue") == SUBID_RANGE_MAX
7e1b55
+        assert set(entry["dnaType"]) == {"ipasubgidnumber", "ipasubuidnumber"}
7e1b55
+
7e1b55
     def test_auto_generate_subid(self):
7e1b55
         uid = "testuser_auto1"
7e1b55
         passwd = "Secret123"
7e1b55
-- 
7e1b55
2.26.3
7e1b55