dotCMS / dotCMS/core

Fix flaky PublisherTest.autoPublishContent test - intermittent AssertionError failures

Open
#33,117 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dotCMS : Technical Debt Flakey Test Priority : 3 Average stale
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.