#49558 Issue 49043 - Add a test suite
Closed by spichugi. Opened by spichugi.
spichugi/389-ds-base conflict_repl  into  master

Download 49558.patch

Description: Add a test suite which checks replication conflict resolution
for basic operations like add, delete, modrdn, modify, operations on groups
with memberOf plugin enabled, managed entries operations and nested entries.
idm/user.py - add create_test_user method which allows default user creation
with given uid and guid.
_mapped_object.py - add delete_tree() method for DSLdaObject class
_constants.py - add access log level constants AccessLog(IntEnum) and ErrorLog(IntEnum)

https://pagure.io/389-ds-base/issue/49043

Reviewed by: ?

rebased onto bd76202e87063a5e51e97460ae6a5fb8ad858f7e

Add an assertion that user_num != new_num so that it's clear that a change has to occur?

Why do you need a sleep?

Given this logic and the end you have a resume + test_replica, you don't need any sleeps on create/rename user.

you need the sleeps to ensure that in each run really the same csn order is generated for the operations. In csn comparison you compare the time stamp and sequence number and if they are identical you compare the replicaid.

So if you run

op1(m2)
op2(m1)
you expect that op1 gets the smaller csn, but in fact if both ops are done in the same second op2 might have the smaller csn.

For a general replication test this wouldn't matter, just ensure that replication is working. But for conflict tests the test scenario are designed to execute a specific order and we need to eliminate random order.

Can this be a python enum instead perhaps?

Really not sure how I feel about this method. It's a bit of a dangerous one, and has really limited use generally as an API. As well you only use it during test finalisation. A better idea could be to limit this to specifically the container type (to enable it to be deleted cleanly), to mark it private (_delete_tree). I'll need to think about it a bit to really know to comment on it properly.

you need the sleeps to ensure that in each run really the same csn order is generated for the operations. In csn comparison you compare the time stamp and sequence number and if they are identical you compare the replicaid.

So if you run
op1(m2)
op2(m1)
you expect that op1 gets the smaller csn, but in fact if both ops are done in the same second op2 might have the smaller csn.

For a general replication test this wouldn't matter, just ensure that replication is working. But for conflict tests the test scenario are designed to execute a specific order and we need to eliminate random order.

rebased onto 762d56e37b97617aa2ad1b4e0fa1f2a059444824

Thank you for the review!
I've added the check to _rename_user function and I've added enum log levels.

Regarding the sleeps, Ludwig has explained his point. We need it for this particular test case.

And about delete_tree method. I agree that it is a dangerous method and we need to think about it carefully.
My arguments for keeping it:
- We need it in API not only for containers but also for organizational units, domains, and organizations.
- It still can be useful for the end user (for instance, ldapdelete has the '-r' functionality).

I think we can add additional warnings for the CLI usage.
And for API, we can still use it for DSLdapObject when we need it.

rebased onto 89980d2260df2ce592ca94649188a7974ecb95f7

rebased onto e8e372a121a5a1e463b89df2cc18d0db72cb2049

Add a filterstr option for delete_branch_s. The 'delete_tree' uses "(|(objectclass=*)(objectclass=ldapsubentry))" now.

rebased onto c42e675fc6f4c754398132a216cfa5686782920d

rebased onto 8f8bee92095a7528d77a0df4bfb5fd25424c74aa

rebased onto 716486ece7feab8c8051f0f8a85d64a19b2d8069

I've fixed issues mentioned by Ludwig: https://pagure.io/389-ds-base/issue/49551#comment-493717

And @firstyear , I removed delete_tree() method. I've moved the functionality to the test suite because it makes more sense to have it there.

rebased onto de4fd1f2662dace4bab9b100883f67a8fab23a4f

Why do you need a sleep here?

Besides the time.sleep(1) you have in here, I'm happy with this. What purpose does the time.sleep here serve? You either need to wait for replication, or you don't need it :)

I tried to explain the need for sleeps ih a comment 16 days ago. It is to ensure the same order of of csns in each run. Since replication is disabled in most of the actions we cannot wait for replication

but, this is needed only when switching from one master to another, not for consecutive changes on the same master. (in my original test had a sleep argument, which was false by default)

rebased onto 3b947b75b63eb9941a4a0a2891aa1251b819f754

I've put the sleeps as you said, @lkrispen

By the way, in the test suite for two masters, you have sleep=True by default...
https://pagure.io/389-ds-base/issue/raw/00571921ea43decbc7d643449783871aefe323fd3c314427161fb228dc22a463-ticket49043_1_test.py

ok for me

rebased onto 14e413ae07832a2ae91617461d1e3cb858891639

Pull-Request has been merged by spichugi

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/2617

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

Metadata