samba.tests.dsdb is not idempotent

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

samba.tests.dsdb is not idempotent

Samba - samba-technical mailing list
Hello.

When the test
samba.tests.dsdb.DsdbTests.test_set_attribute_replmetadata_version is
run two times in the same test run, it fails. This is a problem for
Python3 porting, where the tests need to be run for both versions of the
interpreter in the same run.

The trouble is that I'm lost as to what the test actually does -- I'm
not familiar with terms like "sequence number" or "USN", and the code
calls a maze of functionality deep inside Samba/LDB.

Could I ask you to look at the issue and provide a pointer into what's
wrong here?
I'm attaching a reproducer (run with `make test TESTS=tests.dsdb`).

Thank you and have a nice day.

Lumír


0001-Run-tests.dsdb-for-the-second-time-to-reproduce-prob.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: samba.tests.dsdb is not idempotent

Samba - samba-technical mailing list
On Thursday, 9 November 2017 08:35:33 CET Lumir Balhar via samba-technical
wrote:
> Hello.

Hi Lumír,

> When the test
> samba.tests.dsdb.DsdbTests.test_set_attribute_replmetadata_version is
> run two times in the same test run, it fails. This is a problem for
> Python3 porting, where the tests need to be run for both versions of the
> interpreter in the same run.
>
> The trouble is that I'm lost as to what the test actually does -- I'm
> not familiar with terms like "sequence number" or "USN", and the code
> calls a maze of functionality deep inside Samba/LDB.
>
> Could I ask you to look at the issue and provide a pointer into what's
> wrong here?
> I'm attaching a reproducer (run with `make test TESTS=tests.dsdb`).
the attached patch cleans up the tests and creates a temporary user instead of
tainting the Administrator account!

This should fix your problem.


Could a Samba Team member please review the patch and push if OK?



Thanks,


        Andreas

--
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             [hidden email]
www.samba.org

0001-python-tests-Create-a-test-user-for-the-dsdb-test.patch (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: samba.tests.dsdb is not idempotent

Samba - samba-technical mailing list
On Fri, 2017-11-24 at 16:02 +0100, Andreas Schneider wrote:

> Hi Lumír,
>

> the attached patch cleans up the tests and creates a temporary user instead of
> tainting the Administrator account!
>
> This should fix your problem.
>
>
> Could a Samba Team member please review the patch and push if OK?

The only part I don't like is the fixed password.  While fine here, I
think it is a habit we should avoid.

diff --git a/python/samba/tests/dsdb.py b/python/samba/tests/dsdb.py
index d35f3bb..493ea25 100644
--- a/python/samba/tests/dsdb.py
+++ b/python/samba/tests/dsdb.py
@@ -45,7 +45,7 @@ class DsdbTests(TestCase):
 
         # Create a test user
         user_name = "samdb-testuser"
-        user_pass = "1qazXS@W"
+        user_pass = samba.generate_random_password(32, 32)
         user_description = "Test user for dsdb test"
 
         base_dn = self.samdb.domain_dn()

If you are OK with the amended patch, then I or you can push it.

Thanks!

Andrew Bartlett

--
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba

0001-python-tests-Create-a-test-user-for-the-dsdb-test.patch (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: samba.tests.dsdb is not idempotent

Samba - samba-technical mailing list
On Friday, 24 November 2017 19:57:49 CET Andrew Bartlett via samba-technical
wrote:

> On Fri, 2017-11-24 at 16:02 +0100, Andreas Schneider wrote:
> > Hi Lumír,
> >
> >
> > the attached patch cleans up the tests and creates a temporary user
> > instead of tainting the Administrator account!
> >
> > This should fix your problem.
> >
> >
> > Could a Samba Team member please review the patch and push if OK?
>
> The only part I don't like is the fixed password.  While fine here, I
> think it is a habit we should avoid.
>
> diff --git a/python/samba/tests/dsdb.py b/python/samba/tests/dsdb.py
> index d35f3bb..493ea25 100644
> --- a/python/samba/tests/dsdb.py
> +++ b/python/samba/tests/dsdb.py
> @@ -45,7 +45,7 @@ class DsdbTests(TestCase):
>  
>          # Create a test user
>          user_name = "samdb-testuser"
> -        user_pass = "1qazXS@W"
> +        user_pass = samba.generate_random_password(32, 32)
>          user_description = "Test user for dsdb test"
>  
>          base_dn = self.samdb.domain_dn()
>
> If you are OK with the amended patch, then I or you can push it.
>
> Thanks!

Pushed, thanks!


--
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             [hidden email]
www.samba.org