diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-11-22 15:06:36 +0200 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-11-22 15:24:03 +0100 |
commit | b85dfce74511dac7e623076ef13bf6d3e9f71a20 (patch) | |
tree | 755f188828f3d92869ec1f4e94f3cc51a8e02f34 | |
parent | 9c2bd08498fe6f2caebd42d8a165d282913825bb (diff) | |
download | samba-b85dfce74511dac7e623076ef13bf6d3e9f71a20.tar.gz samba-b85dfce74511dac7e623076ef13bf6d3e9f71a20.tar.bz2 samba-b85dfce74511dac7e623076ef13bf6d3e9f71a20.zip |
s4-test/repl_schema: Remote global ldb connections
Although unlikely, Jelmer pointed out that using persistent
SamDB connections between test may interfere with tests
behaviour (and is not xUnit compliant anyway)
Autobuild-User: Kamen Mazdrashki <kamenim@samba.org>
Autobuild-Date: Mon Nov 22 15:24:03 CET 2010 on sn-devel-104
-rw-r--r-- | source4/torture/drs/python/repl_schema.py | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/source4/torture/drs/python/repl_schema.py b/source4/torture/drs/python/repl_schema.py index 78759e196b..4016ed2105 100644 --- a/source4/torture/drs/python/repl_schema.py +++ b/source4/torture/drs/python/repl_schema.py @@ -44,21 +44,19 @@ import samba.tests class DrsReplSchemaTestCase(samba.tests.TestCase): - # RootDSE msg for DC1 - info_dc1 = None - ldb_dc1 = None - # RootDSE msg for DC1 - info_dc2 = None - ldb_dc2 = None # prefix for all objects created obj_prefix = None def setUp(self): super(DrsReplSchemaTestCase, self).setUp() - # connect to DCs singleton - self._dc_connect("dc1", "DC1", ldap_only=True) - self._dc_connect("dc2", "DC2", ldap_only=True) + # connect to DCs + url_dc = samba.tests.env_get_var_value("DC1") + (self.ldb_dc1, self.info_dc1) = samba.tests.connect_samdb_ex(url_dc, + ldap_only=True) + url_dc = samba.tests.env_get_var_value("DC2") + (self.ldb_dc2, self.info_dc2) = samba.tests.connect_samdb_ex(url_dc, + ldap_only=True) # initialize objects prefix if not done yet if self.obj_prefix is None: @@ -78,22 +76,6 @@ class DrsReplSchemaTestCase(samba.tests.TestCase): def tearDown(self): super(DrsReplSchemaTestCase, self).tearDown() - @classmethod - def _dc_connect(cls, attr_name, env_var, ldap_only=True): - ldb_dc = None - attr_name_ldb = "ldb_" + attr_name - if hasattr(cls, attr_name_ldb): - ldb_dc = getattr(cls, attr_name_ldb) - if ldb_dc is None: - url_dc = samba.tests.env_get_var_value(env_var) - ldb_dc = samba.tests.connect_samdb(url_dc, ldap_only=ldap_only) - res = ldb_dc.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"]) - info_dc = res[0] - setattr(cls, "ldb_" + attr_name, ldb_dc) - setattr(cls, "url_" + attr_name, url_dc) - setattr(cls, "info_" + attr_name, info_dc) - return ldb_dc - def _net_drs_replicate(self, DC, fromDC, nc_dn): """Triggers replication cycle on 'DC' to replicate from 'fromDC'. Naming context to |