diff options
author | Tim Beale <timbeale@catalyst.net.nz> | 2017-08-17 12:30:30 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2017-08-29 07:23:28 +0200 |
commit | b6e6379514ad49e798a80b8464ebfc2b77f86574 (patch) | |
tree | 8b2e01ec0e19fe81e64b0981f841470d2978adba /source4/torture/drs | |
parent | d6a384b24bb762abc340158bbcd3aad828a4b490 (diff) | |
download | samba-b6e6379514ad49e798a80b8464ebfc2b77f86574.tar.gz |
selftest: Use a unique(ish) OU for every run of getnc_unpriv
An intermittent problem I noticed with tests in the past is that the
setup can fail to create the base OU because it already exists.
I believe this is because the previous testenv DC has replicated out the
test object, but not its deletion at the point that the next testenv DC
starts running the test.
This only seemed to happen very occassionally (I haven't seen it
happen with getnc_unpriv yet, but I also haven't run it through the
autobuild yet).
Using same randomness in the test OU should help avoid this sort of
problem, and it matches what some other replication tests do.
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'source4/torture/drs')
-rw-r--r-- | source4/torture/drs/python/getnc_unpriv.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source4/torture/drs/python/getnc_unpriv.py b/source4/torture/drs/python/getnc_unpriv.py index 85fa88da837..8b242b18c9c 100644 --- a/source4/torture/drs/python/getnc_unpriv.py +++ b/source4/torture/drs/python/getnc_unpriv.py @@ -40,6 +40,7 @@ from samba import werror, WERRORError from samba import sd_utils import ldb from ldb import SCOPE_BASE +import random from samba.dcerpc import drsuapi, security from samba.credentials import DONT_USE_KERBEROS @@ -51,13 +52,19 @@ class DrsReplicaSyncUnprivTestCase(drs_base.DrsBaseTestCase): super(DrsReplicaSyncUnprivTestCase, self).setUp() self.get_changes_user = "get-changes-user" self.base_dn = self.ldb_dc1.get_default_basedn() - self.ou = "OU=test_getncchanges,%s" % self.base_dn self.user_pass = samba.generate_random_password(12, 16) + + # add some randomness to the test OU. (Deletion of the last test's + # objects can be slow to replicate out. So the OU created by a previous + # testenv may still exist at this point). + rand = random.randint(1, 10000000) + test_ou = "OU=test_getnc_unpriv%d" %rand + self.ou = "%s,%s" %(test_ou, self.base_dn) self.ldb_dc1.add({ "dn": self.ou, "objectclass": "organizationalUnit"}) self.ldb_dc1.newuser(self.get_changes_user, self.user_pass, - userou="OU=test_getncchanges") + userou=test_ou) (self.drs, self.drs_handle) = self._ds_bind(self.dnsname_dc1) self.sd_utils = sd_utils.SDUtils(self.ldb_dc1) |