From: Jamie McClymont Date: Mon, 8 Jan 2018 06:18:34 +0000 (+1300) Subject: selftest: close connections after tests in samba4.ldap.rodc_rwdc.python X-Git-Tag: talloc-2.1.11~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7901f7c3baad974d3126c767cb4ef513f88564cd;p=thirdparty%2Fsamba.git selftest: close connections after tests in samba4.ldap.rodc_rwdc.python This test suite had a memory impact of around 2.5GB, from built-up LDAP connection handlers under the standard process model. Signed-off-by: Jamie McClymont Reviewed-by: Andrew Bartlett Reviewed-by: Garming Sam Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Tue Jan 9 08:22:27 CET 2018 on sn-devel-144 --- diff --git a/source4/dsdb/tests/python/password_lockout_base.py b/source4/dsdb/tests/python/password_lockout_base.py index 992f51d7822..5f720ef2af4 100644 --- a/source4/dsdb/tests/python/password_lockout_base.py +++ b/source4/dsdb/tests/python/password_lockout_base.py @@ -351,6 +351,8 @@ lockoutThreshold: """ + str(lockoutThreshold) + """ self.samr_handle = self.samr.Connect2(None, security.SEC_FLAG_MAXIMUM_ALLOWED) self.samr_domain = self.samr.OpenDomain(self.samr_handle, security.SEC_FLAG_MAXIMUM_ALLOWED, self.domain_sid) + self.addCleanup(self.delete_ldb_connections) + # (Re)adds the test user accounts self.lockout1krb5_creds = self.insta_creds(self.template_creds, username="lockout1krb5", @@ -363,6 +365,11 @@ lockoutThreshold: """ + str(lockoutThreshold) + """ kerberos_state=DONT_USE_KERBEROS) self.lockout1ntlm_ldb = self._readd_user(self.lockout1ntlm_creds) + def delete_ldb_connections(self): + del self.lockout1krb5_ldb + del self.lockout1ntlm_ldb + del self.ldb + def tearDown(self): super(BasePasswordTestCase, self).tearDown() diff --git a/source4/dsdb/tests/python/rodc_rwdc.py b/source4/dsdb/tests/python/rodc_rwdc.py index 371ff7415c3..8c6dd4cf834 100644 --- a/source4/dsdb/tests/python/rodc_rwdc.py +++ b/source4/dsdb/tests/python/rodc_rwdc.py @@ -224,6 +224,11 @@ class RodcRwdcCachedTests(password_lockout_base.BasePasswordTestCase): # make sure DCs are synchronized before the test self.force_replication() + def delete_ldb_connections(self): + super(RodcRwdcCachedTests, self).delete_ldb_connections() + del self.rwdc_db + del self.rodc_db + def test_cache_and_flush_password(self): username = self.lockout1krb5_creds.get_username() userpass = self.lockout1krb5_creds.get_password() @@ -767,6 +772,11 @@ class RodcRwdcTests(password_lockout_base.BasePasswordTestCase): self.rwdc_dn = get_server_ref_from_samdb(self.rwdc_db) self.rodc_dn = get_server_ref_from_samdb(self.rodc_db) + def delete_ldb_connections(self): + super(RodcRwdcTests, self).delete_ldb_connections() + del self.rwdc_db + del self.rodc_db + def assertReferral(self, fn, *args, **kwargs): try: fn(*args, **kwargs)