[PATCH] selftest: close connections after tests in samba4.ldap.rodc_rwdc.python
jim
jim.brown at rsmas.miami.edu
Mon Jan 8 15:38:43 UTC 2018
'self.addCleanup(self.delete_ldb_connections)' statement is missing from
rodc_rwdc.py?
On 1/8/2018 1:25 AM, Jamie McClymont via samba-technical wrote:
> samba-close-connections-ldap-rodc_rwdc-python.patch
>
>
> From 3f4831630118beead7f6dd067caf8e7f7ef6f4df Mon Sep 17 00:00:00 2001
> From: Jamie McClymont<jamiemcclymont at catalyst.net.nz>
> Date: Mon, 8 Jan 2018 19:18:34 +1300
> Subject: [PATCH] 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<jamiemcclymont at catalyst.net.nz>
> ---
> source4/dsdb/tests/python/password_lockout_base.py | 7 +++++++
> source4/dsdb/tests/python/rodc_rwdc.py | 10 ++++++++++
> 2 files changed, 17 insertions(+)
>
> diff --git a/source4/dsdb/tests/python/password_lockout_base.py b/source4/dsdb/tests/python/password_lockout_base.py
> index 992f51d..5f720ef 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 371ff74..8c6dd4c 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)
> -- 2.7.4
More information about the samba-technical
mailing list