selftest: Add prefix to new schema attributes to avoid flapping dsdb_schema_attributes
authorAndrew Bartlett <abartlet@samba.org>
Sun, 5 Sep 2021 20:52:21 +0000 (08:52 +1200)
committerJeremy Allison <jra@samba.org>
Mon, 6 Sep 2021 02:32:51 +0000 (02:32 +0000)
If two of these unit tests run in the same second they could
select the same name, as the name was only based on the time
and a common prefix.

As observed by Jeremy Allison.  Thanks for the report!

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14819

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Sep  6 02:32:51 UTC 2021 on sn-devel-184

python/samba/tests/dsdb_schema_attributes.py

index bb4603d4703e942de840ecc6cfaa3cde9e869dd8..d9b538d4af43f4f347cdc5b8f280120ad2e05e9f 100644 (file)
@@ -87,7 +87,7 @@ systemOnly: FALSE
 
     def test_AddIndexedAttribute(self):
         # create names for an attribute to add
-        (attr_name, attr_ldap_name, attr_dn) = self._make_obj_names("schemaAttributes-Attr-")
+        (attr_name, attr_ldap_name, attr_dn) = self._make_obj_names("schemaAttributes-IdxAttr-")
         ldif = self._make_attr_ldif(attr_name, attr_dn, 1,
                                     "searchFlags: %d" % samba.dsdb.SEARCH_FLAG_ATTINDEX)
 
@@ -111,7 +111,7 @@ systemOnly: FALSE
 
     def test_AddUnIndexedAttribute(self):
         # create names for an attribute to add
-        (attr_name, attr_ldap_name, attr_dn) = self._make_obj_names("schemaAttributes-Attr-")
+        (attr_name, attr_ldap_name, attr_dn) = self._make_obj_names("schemaAttributes-UnIdxAttr-")
         ldif = self._make_attr_ldif(attr_name, attr_dn, 2)
 
         # add the new attribute
@@ -134,7 +134,7 @@ systemOnly: FALSE
 
     def test_AddTwoIndexedAttributes(self):
         # create names for an attribute to add
-        (attr_name, attr_ldap_name, attr_dn) = self._make_obj_names("schemaAttributes-Attr-")
+        (attr_name, attr_ldap_name, attr_dn) = self._make_obj_names("schemaAttributes-2IdxAttr-")
         ldif = self._make_attr_ldif(attr_name, attr_dn, 3,
                                     "searchFlags: %d" % samba.dsdb.SEARCH_FLAG_ATTINDEX)