Blob Blame History Raw
From b6ab27acdb07c21f43e9dcc9b777f8fd6a8925e1 Mon Sep 17 00:00:00 2001
From: Christian Heimes <cheimes@redhat.com>
Date: Fri, 18 Jun 2021 10:51:54 +0200
Subject: [PATCH] Test DNA plugin configuration

Reviewed-By: Francois Cami <fcami@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Francois Cami <fcami@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
---
 ipatests/test_integration/test_subids.py | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/ipatests/test_integration/test_subids.py b/ipatests/test_integration/test_subids.py
index 48e58c26464f52605438afe865575e5ca4c8f1f8..28cd1f765cd63af944bce83f4676a2b1998f5f5d 100644
--- a/ipatests/test_integration/test_subids.py
+++ b/ipatests/test_integration/test_subids.py
@@ -6,8 +6,11 @@
 """
 import os
 
-from ipalib.constants import SUBID_COUNT, SUBID_RANGE_START, SUBID_RANGE_MAX
+from ipalib.constants import (
+    SUBID_COUNT, SUBID_RANGE_START, SUBID_RANGE_MAX, SUBID_DNA_THRESHOLD
+)
 from ipaplatform.paths import paths
+from ipapython.dn import DN
 from ipatests.pytest_ipa.integration import tasks
 from ipatests.test_integration.base import IntegrationTest
 
@@ -81,6 +84,23 @@ class TestSubordinateId(IntegrationTest):
             cmd.extend(("--owner", uid))
         return self.master.run_command(cmd, **kwargs)
 
+    def test_dna_config(self):
+        conn = self.master.ldap_connect()
+        dna_cfg = DN(
+            "cn=Subordinate IDs,cn=Distributed Numeric Assignment Plugin,"
+            "cn=plugins,cn=config"
+        )
+        entry = conn.get_entry(dna_cfg)
+
+        def single_int(key):
+            return int(entry.single_value[key])
+
+        assert single_int("dnaInterval") == SUBID_COUNT
+        assert single_int("dnaThreshold") == SUBID_DNA_THRESHOLD
+        assert single_int("dnaMagicRegen") == -1
+        assert single_int("dnaMaxValue") == SUBID_RANGE_MAX
+        assert set(entry["dnaType"]) == {"ipasubgidnumber", "ipasubuidnumber"}
+
     def test_auto_generate_subid(self):
         uid = "testuser_auto1"
         passwd = "Secret123"
-- 
2.26.3