Fix flaky PublisherTest.autoPublishContent test - intermittent AssertionError failures
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 970
- Forks
- 486
- Avg merge
- 3d 33m
- Merged PRs (30d)
- 170
Description
Description
The PublisherTest.autoPublishContent test is intermittently flaky, failing with AssertionError at line 456. While the test usually passes, it occasionally fails multiple times within the same CI run (as seen with 4 consecutive retry failures). The test creates a contentlet with publish date, calls PublishDateUpdater.updatePublishExpireDates() to auto-publish, then immediately checks if contentlet.isLive(). Root cause is a race condition between publish operation completion and Elasticsearch index refresh, causing search to return stale contentlet state.
Acceptance Criteria
- Fix the timing issue in the test to prevent intermittent failures
- Ensure test reliably passes by waiting for or forcing Elasticsearch index refresh
- Test should handle the asynchronous nature of ES indexing properly
Additional Notes
This is a timing-dependent flaky test that fails intermittently, not on every run. The race condition manifests when system timing causes the search to execute before ES index reflects the publish state change.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the PublisherTest.autoPublishContent test and its AssertionError at line 456, then trace the call to PublishDateUpdater.updatePublishExpireDates(). Run the test repeatedly to reproduce the race, and finish when the test reliably observes the published state after Elasticsearch indexing has refreshed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, java
- Domain
- search, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100