Skip to content

[BUG] Flaky DefaultAcknowledgementSetManagerTests #6719

@lawofcycles

Description

@lawofcycles

Describe the bug
DefaultAcknowledgementSetManagerTests.testExpirations() intermittently fails in CI with:

java.lang.AssertionError:
Expected: <0>
    but: was <1>
at org.opensearch.dataprepper.core.acknowledgements.DefaultAcknowledgementSetManagerTests.testExpirations(
DefaultAcknowledgementSetManagerTests.java:113)

To Reproduce
Run ./gradlew :data-prepper-core:test --tests "org.opensearch.dataprepper.core.acknowledgements.DefaultAcknowledgementSetManagerTests.testExpirations" --rerun repeatedly. The failure is intermittent and more likely under CPU load.

Expected behavior
The test should pass consistently regardless of system load.

Environment (please complete the following information):

Additional context
The test sleeps for TEST_TIMEOUT * 2 (800ms) and then immediately asserts that the acknowledgement set monitor size is 0. This assumes the monitor's cleanup thread has already removed the expired set during the sleep window. Under CI load, the cleanup may not have completed in time, leaving the size at 1.

The subsequent await().atMost(TEST_TIMEOUT.multipliedBy(3)) only checks the result field, not the monitor size, so the stale monitor size is never retried.

A fix would be to move the getSize() == 0 assertion into an await().untilAsserted() block, similar to the pattern used in testBasic().

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmaintenanceIssues to help maintain the project, such as improving builds, testing, etc.

Type

No type

Projects

Status

Unplanned

Relationships

None yet

Development

No branches or pull requests

Issue actions