From: Aaron Haslett Date: Thu, 4 Apr 2019 01:39:41 +0000 (+1300) Subject: samdb: test for schemainfo update with relax control X-Git-Tag: tdb-1.4.1~471 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e34abefb77729330cd48bc039c82b03fe545f8a9;p=thirdparty%2Fsamba.git samdb: test for schemainfo update with relax control Currently schema info's revision field isn't incremented if relax control is present. This is so that no increment is done during provision, but we need the relax control in other situations where the increment is desired. This patch adds a failing test to expose the problem. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13799 Signed-off-by: Aaron Haslett Reviewed-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett Reviewed-by: Garming Sam --- diff --git a/selftest/knownfail.d/samdb b/selftest/knownfail.d/samdb new file mode 100644 index 00000000000..d2b076a039d --- /dev/null +++ b/selftest/knownfail.d/samdb @@ -0,0 +1 @@ +samba4.schemaInfo.python.*SchemaInfoTestCase.test_AddModifyClassLocalRelaxed.* diff --git a/source4/dsdb/tests/python/dsdb_schema_info.py b/source4/dsdb/tests/python/dsdb_schema_info.py index 60c97b65829..8554e6c6082 100755 --- a/source4/dsdb/tests/python/dsdb_schema_info.py +++ b/source4/dsdb/tests/python/dsdb_schema_info.py @@ -166,16 +166,17 @@ systemOnly: FALSE """ return ldif - def test_AddModifyClass(self): + def test_AddModifyClass(self, controls=[], class_pre="schemaInfo-Class-"): # get initial schemaInfo schi_before = self._getSchemaInfo() # create names for a Class to add - (class_name, class_ldap_name, class_dn) = self._make_obj_names("schemaInfo-Class-") + (class_name, class_ldap_name, class_dn) =\ + self._make_obj_names(class_pre) ldif = self._make_class_ldif(class_name, class_dn, 1) # add the new Class - self.sam_db.add_ldif(ldif) + self.sam_db.add_ldif(ldif, controls=controls) self._ldap_schemaUpdateNow() # compare resulting schemaInfo schi_after = self._getSchemaInfo() @@ -184,7 +185,7 @@ systemOnly: FALSE # rename the Class class_dn_new = class_dn.replace(class_name, class_name + "-NEW") try: - self.sam_db.rename(class_dn, class_dn_new) + self.sam_db.rename(class_dn, class_dn_new, controls=controls) except LdbError as e1: (num, _) = e1.args self.fail("failed to change CN for %s: %s" % (class_name, _)) @@ -192,3 +193,9 @@ systemOnly: FALSE # compare resulting schemaInfo schi_after = self._getSchemaInfo() self._checkSchemaInfo(schi_before, schi_after) + + def test_AddModifyClassLocalRelaxed(self): + lp = self.get_loadparm() + self.sam_db = samba.tests.connect_samdb(lp.samdb_url()) + self.test_AddModifyClass(controls=["relax:0"], + class_pre="schemaInfo-Relaxed-") diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index f74678fb90b..db51e97a78e 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -837,7 +837,7 @@ plantestsuite_loadlist("samba4.tokengroups.ntlm.python(ad_dc_default)", "ad_dc_d plantestsuite("samba4.sam.python(fl2008r2dc)", "fl2008r2dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sam.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN']) plantestsuite("samba4.sam.python(ad_dc_default)", "ad_dc_default", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sam.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN']) plantestsuite("samba4.user_account_control.python(ad_dc_default)", "ad_dc_default", [python, os.path.join(samba4srcdir, "dsdb/tests/python/user_account_control.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN']) -planoldpythontestsuite("ad_dc_default", "dsdb_schema_info", +planoldpythontestsuite("ad_dc_default:local", "dsdb_schema_info", extra_path=[os.path.join(samba4srcdir, 'dsdb/tests/python')], name="samba4.schemaInfo.python(ad_dc_default)", extra_args=['-U"$DOMAIN/$DC_USERNAME%$DC_PASSWORD"'])