-
Notifications
You must be signed in to change notification settings - Fork 103
Issue 6258 - Mitigate race condition in paged_results_test.py #6433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dadec79 to
f7c7fa8
Compare
|
Amended commit to move a helper function inside the test function for readability. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
FYI: rather than using indexes to extract the string you can also use directly the regular expression module. Here is an use example:
import re
str="xxxx op=123 conn=567 RESULT xxx"
result = re.search(r'(op=\d+ conn=\d+)', str)
print(result.group(1))
|
I agree with @progier389, this should be a regex. |
f7c7fa8 to
e901e1b
Compare
|
Amended commit to correct the error in the message and replace the string index function with the simpler regex solution. Full test runtime for paged_results_test.py comes in at 6 minutes 46 seconds. |
|
Looks good. |
e901e1b to
a5cc7f2
Compare
|
Added missing re import. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides that, LGTM!
| @@ -1126,6 +1127,8 @@ def test_multi_suffix_search(topology_st, create_user, new_suffixes): | |||
| topology_st.standalone.restart(timeout=10) | |||
|
|
|||
| access_log_lines = topology_st.standalone.ds_access_log.match('.*pr_cookie=.*') | |||
| # Sort access_log_lines by op number to mitigate race condition effects. | |||
| access_log_lines.sort(key=lambda x: int(re.search(r"op=(.*?) RESULT", x).group(1))) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick, but I think we should be as specific as possible to avoid any weird issues:
| access_log_lines.sort(key=lambda x: int(re.search(r"op=(.*?) RESULT", x).group(1))) | |
| access_log_lines.sort(key=lambda x: int(re.search(r"op=(\d+) RESULT", x).group(1))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! The commit is amended now with that change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Full test runtime comes in at 7 minutes 2 seconds.
The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order. This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search(). Fixes: 389ds#6258
a5cc7f2 to
2848e3e
Compare
…6433) The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order. This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search(). Helps fix: 389ds#6258 Reviewed by: @droideck , @progier389 (Thanks!)
…6433) The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order. This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search(). Helps fix: 389ds#6258 Reviewed by: @droideck , @progier389 (Thanks!)
…6433) The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order. This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search(). Helps fix: 389ds#6258 Reviewed by: @droideck , @progier389 (Thanks!)
…6433) The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order. This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search(). Helps fix: 389ds#6258 Reviewed by: @droideck , @progier389 (Thanks!)
…6433) The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order. This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search(). Helps fix: 389ds#6258 Reviewed by: @droideck , @progier389 (Thanks!)
…6433) The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order. This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search(). Helps fix: 389ds#6258 Reviewed by: @droideck , @progier389 (Thanks!)
The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order. This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search(). Helps fix: #6258 Reviewed by: @droideck , @progier389 (Thanks!) Co-authored-by: Anuar Beisembayev <111912342+abeisemb@users.noreply.github.com>
The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order. This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search(). Helps fix: #6258 Reviewed by: @droideck , @progier389 (Thanks!) Co-authored-by: Anuar Beisembayev <111912342+abeisemb@users.noreply.github.com>
The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order. This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search(). Helps fix: #6258 Reviewed by: @droideck , @progier389 (Thanks!) Co-authored-by: Anuar Beisembayev <111912342+abeisemb@users.noreply.github.com>
The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order. This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search(). Helps fix: #6258 Reviewed by: @droideck , @progier389 (Thanks!) Co-authored-by: Anuar Beisembayev <111912342+abeisemb@users.noreply.github.com>
The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order. This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search(). Helps fix: #6258 Reviewed by: @droideck , @progier389 (Thanks!) Co-authored-by: Anuar Beisembayev <111912342+abeisemb@users.noreply.github.com>
The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order. This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search(). Helps fix: #6258 Reviewed by: @droideck , @progier389 (Thanks!) Co-authored-by: Anuar Beisembayev <111912342+abeisemb@users.noreply.github.com>
The regression test dirsrvtests/tests/suites/paged_results/paged_results_test.py::test_multi_suffix_search has a race condition causing it to fail due to multiple queries potentially writing their logs out of chronological order.
This failure is mitigated by sorting the retrieved access_log_lines by their "op" value. This ensures the log lines are in chronological order, as expected by the assertions at the end of test_multi_suffix_search().
Helps fix: #6258
Reviewed by: @droideck , @progier389 (Thanks!)