Bug Description: When a search fails because it requests more than one empty attribute, the search base DN is always logged as "(null)".
Fix Description: The search base DN for the failed search request is logged. This commit include the automated test to verify the correct behavior. Fixes https://pagure.io/389-ds-base/issue/50428 Relates: https://pagure.io/389-ds-base/issue/49969 Author: Sylvie Gouverneyre Reviewed by: Viktor Ashirov, Simon Pichugin, Thierry Bordaz
We're trying to avoid using pure DSLdapObject because it is more explicit and optimal to use the exact objects that represent the entity. Here, you can set -
DSLdapObject
from lib389.idm.domain import Domain entry = Domain(topology_st.standalone, DEFAULT_SUFFIX)
I think it makes sense to clean the accesslog because you are looking for a basic thing to appear - (r'.*SRCH base="{}".*'.format(DEFAULT_SUFFIX). And it's very possible that previous tests could affect it. It can be done like this - topo.deleteAccessLogs()
accesslog
(r'.*SRCH base="{}".*'.format(DEFAULT_SUFFIX)
topo.deleteAccessLogs()
Could you also, please, fix the previous test's finalization? If I run the whole test suite, your test case fails because of the previous test function (test_etime_at_border_of_second). It has stopped the instance and then it didn't resume. You can put it to try: finally: block, I think.
test_etime_at_border_of_second
try: finally:
Otherwise, it's a very nice and smooth test case! Thanks!
Also, we refer the upstream issue in commit messages.
So please, replace the Bugzilla link with this https://pagure.io/389-ds-base/issue/50428
We're trying to avoid using pure DSLdapObject because it is more explicit and optimal to use the exact objects that represent the entity.
Since when we're trying to avoid to use it? Entry was frowned upon, but not DSLdapObject. Morover, Domain is DSLdapObject. The point of the test case is to do a search on any entry, not domain specifically, but with a list of empty attributes. So any class that inherits DSLdapObject would do including DSLdapObject itself.
Entry
Domain
A minor point. You may comment that this protocol error is a consequence of https://pagure.io/389-ds-base/issue/49969. A search request containing more than one empty attribute fails with protocol error.
Thanks for your comments, working on it.
I agree. Please, note that I mentioned pure DSLdapObject. She has decided to search a Domain - we have an object for that and I gave the example. :)
pure
rebased onto efa244d87585f5dbf4d8f9cd992d5dcb99fc2cc3
Changes are done, could you please review.
There is a second block of code:
# be sure to analyze only the following rapid OPs topo.stop() os.remove(topo.accesslog) topo.start()
It also has the 'stop()' part which can affect the next test case execution in case os.remove(topo.accesslog) fails.
os.remove(topo.accesslog)
As an option, you can write a small fixture here (scope="function"). And ensure the instance is in the right state.
Could you please comment why have you decided not to use Domain object as I suggested?..
I agree that it's more explicit to use the exact object of an entity, and that it should preferably be used. Precisely in this case, I preferred not to use Domain object because the objective of the test is to check the logs registered after a search with invalid attributes, whatever the nature of the object searched is. I chose to use a domain for convenience, but I feel in this specific case it could be misleading to insist on the nature of the object as being a domain, because it could make lose sight on the generic scope of the test.
I didn't noticed the possible impact of a failure of os.remove(topo.accesslog) in the previous test_etime_at_border_of_second test. I'm going to rework on this test to securise its impact, as you suggest. Thanks for pointing that !
rebased onto 790edfd17a42dd5987659351595dcf38900577c2
Changes done. Could you please review, thanks.
It looks good to me. Let's wait for @spichugi and @vashirov final point.
LGTM! Thanks!
Thank you all for your reviews !
rebased onto 8365205ac20f49c61fb8ea8aa4a57dc36c794120
With Viktor's review, and after falling in failures when running the test suite, it appeared that the whole suite needs be improved to be more robust. Commit Description: The search base DN for the failed search request is logged. This commit include the automated test to verify the correct behavior. It includes as well changes to make the whole test suite more robust: .adding the clean_access_logs fixture to make sure the state left by a test doesn't affect the others .using this fixture in relevant tests .adding the xfail mark for relevant tests .fixing test_internal_log_server_level_4 for it to restore the default log level config before ending in case of failure, to avoid to affect the next test cases .Handling a possible failure in removing a log file in lib389 deleteLog function
Could you please review (again !) these changes ? Thanks for your patience !
rebased onto e89c717540a39a57e422b1c6d9005a2059b7b889
rebased onto bd3b6f536a9b82bf207aed893b2bed194c431818
rebased onto cbcf26265642400a92e55f263f31f38ba4b7d1dc
This shouldn't be uncommented.
I get an error here:
ImportError while loading conftest '/mnt/tests/rhds/tests/upstream/ds/dirsrvtests/conftest.py'. dirsrvtests/conftest.py:8: in <module> from lib389.paths import Paths E File "/mnt/tests/rhds/tests/upstream/ds/src/lib389/lib389/__init__.py", line 3126 E try: E ^ E TabError: inconsistent use of tabs and spaces in indentation
rebased onto 49177819df514fd4bdbebb8dbe66a709fe9f9804
rebased onto 2f5daa792337c66633095e052b7191adadb07469
I fixed the comment and indentation problem. Could you please review.
Thank you, Sylvie! Everything works now. Ack.
Pull-Request has been merged by vashirov
Thanks !
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/3684
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
Bug Description:
When a search fails because it requests more than one empty attribute,
the search base DN is always logged as "(null)".