Fix flaky DefaultAcknowledgementSetManagerTests#6720
Open
lawofcycles wants to merge 1 commit intoopensearch-project:mainfrom
Open
Fix flaky DefaultAcknowledgementSetManagerTests#6720lawofcycles wants to merge 1 commit intoopensearch-project:mainfrom
lawofcycles wants to merge 1 commit intoopensearch-project:mainfrom
Conversation
Move the monitor size assertion into the await().untilAsserted() block. The assertion was placed after Thread.sleep() but before await(), assuming the cleanup thread had already run. Under CI load, the cleanup may not have completed in time, causing intermittent failures. Signed-off-by: Sotaro Hikita <bering1814@gmail.com>
b341a4e to
d30a69a
Compare
Contributor
Author
|
found another flaky test: https://github.com/opensearch-project/data-prepper/actions/runs/23930747072/job/69797135261?pr=6720 |
dlvenable
approved these changes
Apr 6, 2026
kkondaka
approved these changes
Apr 6, 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.
Description
Fix flaky
DefaultAcknowledgementSetManagerTests.testExpirations()that intermittently fails withAssertionError: Expected: <0> but: was <1>.The test asserts that the acknowledgement set monitor size is 0 immediately after a
Thread.sleep(), assuming the cleanup thread has already removed the expired set. Under CI load, the cleanup may not have completed in time. The subsequentawait()block only checks theresultfield, not the monitor size, so the stale size is never retried.This change moves the
getSize() == 0assertion into theawait().untilAsserted()block so both conditions are polled together.CI impact
This fix targets
Gradle Build / buildworkflow (gradle.yml), specificallyDefaultAcknowledgementSetManagerTests.testExpirations()in:data-prepper-core:test.Local verification (10 consecutive runs each):
The race condition is difficult to reproduce with the default
TEST_TIMEOUT(400ms) on a local machine. To amplify it, theThread.sleepintestExpirationswas temporarily hardcoded to 20ms (instead ofTEST_TIMEOUT * 2= 800ms), reducing the margin for the cleanup thread to near zero.Issues Resolved
Resolves #6719
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.