Issue 6753 - Port ticket 48266 test#7393
Open
mirielka wants to merge 1 commit into389ds:mainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The helper functions
_fractional_m2_get_first_not_replicated_csnand_fractional_m2_get_last_not_replicated_csnduplicate almost all of their logic; consider extracting a single parameterized helper that takes the account index and returns the CSN to reduce repetition and make future changes less error-prone. _fractional_m2_count_full_sessionrereads the entire error log file on each invocation; if these tests run frequently or on large logs, it may be worth tracking the last-read position (viatell/seek) or iterating only from the end to avoid repeated full scans.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The helper functions `_fractional_m2_get_first_not_replicated_csn` and `_fractional_m2_get_last_not_replicated_csn` duplicate almost all of their logic; consider extracting a single parameterized helper that takes the account index and returns the CSN to reduce repetition and make future changes less error-prone.
- `_fractional_m2_count_full_session` rereads the entire error log file on each invocation; if these tests run frequently or on large logs, it may be worth tracking the last-read position (via `tell`/`seek`) or iterating only from the end to avoid repeated full scans.
## Individual Comments
### Comment 1
<location path="dirsrvtests/tests/suites/fractional/fractional_test.py" line_range="548-557" />
<code_context>
+@pytest.mark.tier2
</code_context>
<issue_to_address>
**issue (testing):** Strengthen assertions and timeouts in `test_fractional_m2_csn_evaluation_count` to avoid flaky or misleading behavior
The polling loops (`while current_no_more_update == no_more_update_cnt`) exit after `max_loop` iterations without asserting that any progress occurred. If `current_no_more_update` never increases, the test still proceeds and `assert not found_skip` can pass simply because replication/log scanning never completed. To make this test robust against regressions in ticket 48266, please:
- Add assertions after each loop that verify progress (e.g., `current_no_more_update > no_more_update_cnt` or another concrete indicator such as session count or presence of the dummy update CSN), rather than only logging.
- Optionally add an explicit overall timeout with a clear failure message when replication does not progress, instead of allowing the test to “succeed” with incomplete conditions.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The helper functions
_fractional_m2_get_first_not_replicated_csnand_fractional_m2_get_last_not_replicated_csnduplicate almost all of their logic; consider extracting a single CSN helper that takes the target DN or UID index as a parameter to reduce repetition and keep them in sync. - In
fractional_m2_setup,UserAccounts(supplier1, DEFAULT_SUFFIX)is instantiated on each loop iteration and the finalizer deletes all users under the suffix; you could instantiateUserAccountsonce and track/delete only the created test entries to avoid impacting unrelated users. - The fixture
fractional_m2_setupalready ensures and tests replication after restart, andtest_fractional_m2_replicationrepeats the sameensure_agreement/test_replicationcalls; consider relying on the fixture setup to avoid redundant replication checks.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The helper functions `_fractional_m2_get_first_not_replicated_csn` and `_fractional_m2_get_last_not_replicated_csn` duplicate almost all of their logic; consider extracting a single CSN helper that takes the target DN or UID index as a parameter to reduce repetition and keep them in sync.
- In `fractional_m2_setup`, `UserAccounts(supplier1, DEFAULT_SUFFIX)` is instantiated on each loop iteration and the finalizer deletes all users under the suffix; you could instantiate `UserAccounts` once and track/delete only the created test entries to avoid impacting unrelated users.
- The fixture `fractional_m2_setup` already ensures and tests replication after restart, and `test_fractional_m2_replication` repeats the same `ensure_agreement`/`test_replication` calls; consider relying on the fixture setup to avoid redundant replication checks.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
droideck
requested changes
Apr 14, 2026
f4eb6f5 to
6b26dfe
Compare
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
test_fractional_m2_csn_evaluation_count, the last wait loop (while current_no_more_update == no_more_update_cnt:) never updatescurrent_no_more_updateinside the loop as the previous two loops do, so it will always break only onmax_loopand then use a stale value afterward; this should be refactored to refreshcurrent_no_more_updateeach iteration or share a common helper for this wait pattern. - The repeated patterns for waiting on replication sessions to complete (three similar
whileloops withmax_loop,cnt,time.sleep(5), and_fractional_m2_count_full_session) could be extracted into a small helper function to maketest_fractional_m2_csn_evaluation_counteasier to read and less error-prone.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `test_fractional_m2_csn_evaluation_count`, the last wait loop (`while current_no_more_update == no_more_update_cnt:`) never updates `current_no_more_update` inside the loop as the previous two loops do, so it will always break only on `max_loop` and then use a stale value afterward; this should be refactored to refresh `current_no_more_update` each iteration or share a common helper for this wait pattern.
- The repeated patterns for waiting on replication sessions to complete (three similar `while` loops with `max_loop`, `cnt`, `time.sleep(5)`, and `_fractional_m2_count_full_session`) could be extracted into a small helper function to make `test_fractional_m2_csn_evaluation_count` easier to read and less error-prone.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
droideck
reviewed
Apr 27, 2026
Description: Port ticket 48266 test into dirsrvtests/tests/suites/fractional/fractional_test.py using lib389 API. Relates: 389ds#6753 Author: Lenka Doudova Assisted by: Cursor Reviewer: @droideck (Thanks!)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Port ticket 48266 test into dirsrvtests/tests/suites/fractional/fractional_test.py using lib389 API.
Relates: #6753
Author: Lenka Doudova
Assisted by: Cursor
Reviewer: ???
Summary by Sourcery
Port the ticket 48266 fractional replication test into the main fractional test suite using the lib389 API and two-supplier topology_m2 fixtures.
Tests: