fix: increase assertChangelogAttributesInRootDSE retry timeout from 10s to 30s#616
Merged
vharseko merged 2 commits intocopilot/fix-inverted-logic-substring-checkfrom Apr 2, 2026
Conversation
Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenDJ/sessions/cae7e199-d7a4-46e5-be82-3e914bbed1e6 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix flaky test timeout in ChangelogBackendTestCase
fix: increase assertChangelogAttributesInRootDSE retry timeout from 10s to 30s
Apr 2, 2026
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.
ChangelogBackendTestCase.searchInChangeNumberModeOnOneSuffixMultipleTimesis flaky onmacos-latestCI runners becausefirstchangenumberis assigned asynchronously and the 10-second retry window inassertChangelogAttributesInRootDSEis insufficient, causing the assertion to observe0instead of1.Change
ChangelogBackendTestCase.java— bumpsmaxSleepinassertChangelogAttributesInRootDSEfrom10→30seconds, matching the existing timeout already used bysearchChangelogin the same file:Original prompt
Problem
The CI job for PR #599 is failing on the
macos-latestrunner due to a flaky test:Test:
ChangelogBackendTestCase.searchInChangeNumberModeOnOneSuffixMultipleTimesFile:
opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.javaError:
Root Cause
The method
assertChangelogAttributesInRootDSE(lines 854-890) uses aTestTimerwith a 10-second timeout to poll the Root DSE forfirstchangenumberandlastchangenumber. On slower environments like themacos-latestGitHub Actions runner, change number assignment happens asynchronously and 10 seconds is insufficient forfirstchangenumberto transition from0to1.Other retry timers in the same file (e.g.,
searchChangelogat line 1124) already use 30 seconds, making the 10-second timeout inassertChangelogAttributesInRootDSEinconsistent and the likely cause of flakiness.Fix
In
opendj-server-legacy/src/test/java/org/opends/server/backends/ChangelogBackendTestCase.java, increase themaxSleeptimeout in theassertChangelogAttributesInRootDSEmethod from10seconds to30seconds:Before (line 857-860):
After:
This makes the timeout consistent with the other retry timer in
searchChangelog(line 1124-1127) and gives enough time for the asynchronous change number assignment to complete on slower CI runners.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant:
I'll start by fetching the job logs and the workflow definition to understand the failure.
Assistant: ## Failing Test Analysis
The build is failing due to 1 actual test failure (the PostgreSQL/JDBC tests are only skipped, not failed):
Root Cause
ChangelogBackendTestCase.searchInChangeNumberModeOnOneSuffixMultipleTimesfails at line 589 with:The call chain is:
searchInChangeNumberModeOnOneSuffixMultipleTimes(line 589)assertChangelogAttributesInRootDSE(1, 4)(line 861)assertAttributeValue(entry, "firstchangenumber", 1)(line 882 → line 1431)What's Happening
In the test method
searchInChangeNumberModeOnOneSuffixMultipleTimes(line 581–615), the first block publishes 4 changes and then assertsfirstchangenumber=1. However, thefirstchangenumberattribute in the Root DSE is returning0instead of1, indicating the changelog's change number indexing hasn't been assigned yet by the time the assertion runs.The method
assertChangelogAttributesInRootDSE(line 854–890) already has a retry loop with a 10-second timeout, but change number assignment appears to be happening asynchronously andfirstchangenumberstays at0even afterlastchangenumberreaches the expected value.Suggested Fix
The issue is a race condition — the
firstchangenumberis checked only whenexpectedFirstChangeNumber > 0, but the retry loop can succeed whenlastchangenumbermatches whilefirstchangenumberis still0. The fix is to always verifyfirstchangenumberwithin the retry loop when it's expected to be positive: