- Resolves: RHEL-5141 - [RFE] For each request, a ldap client can assign an identifier to be added in the logs - Resolves: RHEL-77948 - ns-slapd crashes with data directory ≥ 2 days old [rhel-10] - Resolves: RHEL-78342 - During import of entries without nsUniqueId, a supplier generates duplicate nsUniqueId (LMDB only)
44 lines
2.0 KiB
Diff
44 lines
2.0 KiB
Diff
From be57ea839934c29b3f4db450a65281aa30a72caf Mon Sep 17 00:00:00 2001
|
|
From: Masahiro Matsuya <mmatsuya@redhat.com>
|
|
Date: Wed, 5 Feb 2025 11:38:28 +0900
|
|
Subject: [PATCH] Issue 6258 - Mitigate race condition in paged_results_test.py
|
|
(#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: #6258
|
|
|
|
Reviewed by: @droideck , @progier389 (Thanks!)
|
|
|
|
Co-authored-by: Anuar Beisembayev <111912342+abeisemb@users.noreply.github.com>
|
|
---
|
|
dirsrvtests/tests/suites/paged_results/paged_results_test.py | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
diff --git a/dirsrvtests/tests/suites/paged_results/paged_results_test.py b/dirsrvtests/tests/suites/paged_results/paged_results_test.py
|
|
index eaf0e0da9..fca48db0f 100644
|
|
--- a/dirsrvtests/tests/suites/paged_results/paged_results_test.py
|
|
+++ b/dirsrvtests/tests/suites/paged_results/paged_results_test.py
|
|
@@ -7,6 +7,7 @@
|
|
# --- END COPYRIGHT BLOCK ---
|
|
#
|
|
import socket
|
|
+import re
|
|
from random import sample, randrange
|
|
|
|
import pytest
|
|
@@ -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=(\d+) RESULT", x).group(1)))
|
|
pr_cookie_list = ([line.rsplit('=', 1)[-1] for line in access_log_lines])
|
|
pr_cookie_list = [int(pr_cookie) for pr_cookie in pr_cookie_list]
|
|
log.info('Assert that last pr_cookie == -1 and others pr_cookie == 0')
|
|
--
|
|
2.48.0
|
|
|