[PATCH] selftest: close connections after tests in samba4.ldap.rodc_rwdc.python

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] selftest: close connections after tests in samba4.ldap.rodc_rwdc.python

Samba - samba-technical mailing list
Hi all,

Follow-up to the two earlier patches.
Review appreciated.

Thanks,
- Jamie


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] selftest: close connections after tests in samba4.ldap.rodc_rwdc.python

Samba - samba-technical mailing list
One day I will learn to attach a patch before sending it, I swear.

On 08/01/18 19:24, Jamie McClymont wrote:
> Hi all,
>
> Follow-up to the two earlier patches.
> Review appreciated.
>
> Thanks,
> - Jamie
>

samba-close-connections-ldap-rodc_rwdc-python.patch (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] selftest: close connections after tests in samba4.ldap.rodc_rwdc.python

Samba - samba-technical mailing list
'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<[hidden email]>
> 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<[hidden email]>
> ---
>   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

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] selftest: close connections after tests in samba4.ldap.rodc_rwdc.python

Samba - samba-technical mailing list
On 09/01/18 04:38, jim via samba-technical wrote:
> 'self.addCleanup(self.delete_ldb_connections)' statement is missing from
> rodc_rwdc.py?

The rodc_rwdc suites inherit from BasePasswordTestCase which adds that
cleanup (and the rodc_rwdc delete_ldb_connections methods call super).

It certainly seems to close all the connections now, from graphing the
process count over the course of the suite run.

Thanks
- Jamie