summaryrefslogtreecommitdiff
path: root/source4/torture/drs/python/link_conflicts.py
diff options
context:
space:
mode:
authorTim Beale <timbeale@catalyst.net.nz>2018-03-15 12:44:30 +1300
committerGarming Sam <garming@samba.org>2018-05-11 06:01:23 +0200
commit597428943b1b77267243dc69ecea6fda8dfc3163 (patch)
tree0c55ce675bd572554ae252ad5a0934ab9144b1a8 /source4/torture/drs/python/link_conflicts.py
parentb07b4e459e95f2609af651e579d3b0b01b8a4c7e (diff)
downloadsamba-597428943b1b77267243dc69ecea6fda8dfc3163.tar.gz
tests: Move repeated code into a helper function
Several tests hang all the objects they create off a unique OU. Having a common OU makes cleanup easier, and having a unique OU (i.e. adding some randomness) helps protect against one-off test failures (Replication between testenvs is happening in the background. Occasionally, when a test finishes on one testenv and moves onto the next testenv, that testenv may have received the replicated test objects from the first testenv, but has not received their deletion yet). Rather than copy-n-pasting this code yet again, split it out into a helper function. Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Diffstat (limited to 'source4/torture/drs/python/link_conflicts.py')
-rw-r--r--source4/torture/drs/python/link_conflicts.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/source4/torture/drs/python/link_conflicts.py b/source4/torture/drs/python/link_conflicts.py
index 6522fb610d6..31ebc30fc44 100644
--- a/source4/torture/drs/python/link_conflicts.py
+++ b/source4/torture/drs/python/link_conflicts.py
@@ -46,15 +46,8 @@ class DrsReplicaLinkConflictTestCase(drs_base.DrsBaseTestCase):
def setUp(self):
super(DrsReplicaLinkConflictTestCase, self).setUp()
- # 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)
+ self.ou = samba.tests.create_test_ou(self.ldb_dc1, "test_link_conflict")
self.base_dn = self.ldb_dc1.get_default_basedn()
- self.ou = "OU=test_link_conflict%d,%s" %(rand, self.base_dn)
- self.ldb_dc1.add({
- "dn": self.ou,
- "objectclass": "organizationalUnit"})
(self.drs, self.drs_handle) = self._ds_bind(self.dnsname_dc1)
(self.drs2, self.drs2_handle) = self._ds_bind(self.dnsname_dc2)