Skip to content

Fix [BUG] ClusterMaxMergesAtOnceIT is flaky#19647

Merged
andrross merged 6 commits intoopensearch-project:mainfrom
laminelam:flacky/test1
Dec 8, 2025
Merged

Fix [BUG] ClusterMaxMergesAtOnceIT is flaky#19647
andrross merged 6 commits intoopensearch-project:mainfrom
laminelam:flacky/test1

Conversation

@laminelam
Copy link
Copy Markdown
Contributor

@laminelam laminelam commented Oct 15, 2025

Resolves #18056

[BUG] ClusterMaxMergesAtOnceIT is flaky

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.

Summary by CodeRabbit

  • Bug Fixes
    • Improved test reliability by fixing an intermittent failure in cluster merge-policy validation; this reduces spurious test failures and improves CI stability.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>
@github-actions github-actions bot added bug Something isn't working disabled-test Issues that are used by an AwaitsFix annotation to temporarily disable a broken test flaky-test Random test failure that succeeds on second run Indexing Indexing, Bulk Indexing and anything related to indexing labels Oct 15, 2025
update change log

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>
@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for 17e5f99: SUCCESS

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.21%. Comparing base (d47931e) to head (7701d2c).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19647      +/-   ##
============================================
- Coverage     73.30%   73.21%   -0.09%     
+ Complexity    71732    71706      -26     
============================================
  Files          5793     5793              
  Lines        328056   328110      +54     
  Branches      47245    47256      +11     
============================================
- Hits         240476   240228     -248     
- Misses        68264    68595     +331     
+ Partials      19316    19287      -29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@laminelam
Copy link
Copy Markdown
Contributor Author

Hi @andrross
Do you have time to review this?

@laminelam laminelam requested a review from msfroh November 2, 2025 12:10
@laminelam
Copy link
Copy Markdown
Contributor Author

Hi @msfroh
Can you please give this a second look? Hope my previous comments answer your question.

@andrross
Copy link
Copy Markdown
Member

Hi @msfroh Can you please give this a second look? Hope my previous comments answer your question.

@laminelam I don't see any response from you on this PR. Can you address the questions raised here?

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 8, 2025

Walkthrough

Removed the test workaround and made the third index creation explicit by wrapping it with assertAcked(prepareCreate(...)), and added a changelog entry documenting the fix for ClusterMaxMergesAtOnceIT.testClusterLevelDefaultUpdatesMergePolicy.

Changes

Cohort / File(s) Change Summary
Changelog
CHANGELOG.md
Added a Fixed entry documenting the fix for the flaky test ClusterMaxMergesAtOnceIT.testClusterLevelDefaultUpdatesMergePolicy (#18056).
Test synchronization & cleanup
server/src/internalClusterTest/java/org/opensearch/index/ClusterMaxMergesAtOnceIT.java
Removed @AwaitsFix from testClusterLevelDefaultUpdatesMergePolicy; added static import for assertAcked; changed third index creation to assertAcked(prepareCreate(indexName, Settings.builder(...))) to ensure proper index creation synchronization; minor formatting adjustments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Review the modified test method for correct use of assertAcked and Settings builder.
  • Verify removal of @AwaitsFix is appropriate and no other tests rely on it.
  • Check the changelog addition for correct formatting and placement.

Poem

🐰 A jittery test hopped into the night,
I wrapped its nest with assertAcked tight,
The nulls ran off, the merges mend,
Now CI sleeps and dreams ascend,
Hooray — one less flaky fright! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing a flaky test in ClusterMaxMergesAtOnceIT.
Description check ✅ Passed The description identifies the related issue (#18056) and states the fix resolves the flaky test, but lacks specific details about what changes were made to resolve the flakiness.
Linked Issues check ✅ Passed The PR addresses the core requirements from issue #18056: it fixes the flaky test by removing the AwaitsFix annotation and fixing the NullPointerException issue with the third IndexService.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the flaky test issue: CHANGELOG.md entry documents the fix, and ClusterMaxMergesAtOnceIT.java contains the actual test fix.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9154fe7 and 7701d2c.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
  • GitHub Check: gradle-check
  • GitHub Check: Analyze (java)
  • GitHub Check: detect-breaking-change
  • GitHub Check: precommit (21, macos-15)
  • GitHub Check: precommit (25, ubuntu-24.04-arm)
  • GitHub Check: precommit (25, ubuntu-latest)
  • GitHub Check: precommit (25, macos-15)
  • GitHub Check: precommit (21, windows-2025, true)
  • GitHub Check: precommit (25, macos-15-intel)
  • GitHub Check: precommit (21, ubuntu-24.04-arm)
  • GitHub Check: precommit (21, windows-latest)
  • GitHub Check: precommit (25, windows-latest)
  • GitHub Check: precommit (21, ubuntu-latest)
  • GitHub Check: precommit (21, macos-15-intel)
  • GitHub Check: assemble (21, ubuntu-24.04-arm)
  • GitHub Check: Mend Security Check
  • GitHub Check: assemble (25, ubuntu-latest)
  • GitHub Check: assemble (21, ubuntu-latest)
  • GitHub Check: assemble (25, ubuntu-24.04-arm)
  • GitHub Check: assemble (21, windows-latest)
  • GitHub Check: assemble (25, windows-latest)

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
CHANGELOG.md (1)

23-30: Changelog entry looks good; consider aligning link style with neighbors

The new Fixed entry clearly documents the flaky-test fix and links the underlying issue. If this project’s convention is to reference PRs in the changelog (as neighboring lines do), you may want to either:

  • Switch this to the PR URL, or
  • Include both issue and PR numbers for consistency.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 387e663 and 9154fe7.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • server/src/internalClusterTest/java/org/opensearch/index/ClusterMaxMergesAtOnceIT.java (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
server/src/internalClusterTest/java/org/opensearch/index/ClusterMaxMergesAtOnceIT.java (1)
server/src/main/java/org/opensearch/index/TieredMergePolicyProvider.java (1)
  • TieredMergePolicyProvider (132-328)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: gradle-check
🔇 Additional comments (2)
server/src/internalClusterTest/java/org/opensearch/index/ClusterMaxMergesAtOnceIT.java (2)

50-52: assertAcked import is appropriate for the new index-creation pattern

The static import of assertAcked matches the updated usage below and keeps the test code concise.


99-106: Verification inconclusive—please provide code context or test results

The claim that switching to assertAcked(prepareCreate(...)) fixes the NPE by ensuring replica settings are applied requires confirmation. The logical connection between a merge policy setting override and replica presence on data nodes is unclear. Please either:

  • Share the full test method and baseIndexSettings() definition to confirm how settings are applied
  • Provide test execution results demonstrating stability with the seed 2BD0981DD7D9F5EF before and after this change

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 8, 2025

❌ Gradle check result for 9154fe7: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 8, 2025

✅ Gradle check result for 7701d2c: SUCCESS

@andrross andrross merged commit e3a1533 into opensearch-project:main Dec 8, 2025
35 checks passed
fdesu pushed a commit to fdesu/OpenSearch that referenced this pull request Dec 13, 2025
* Fix flack test opensearch-project#18056

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>

* remove AwaitsFix annotation
update change log

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>

* use prepareCreate to merge with setup settings

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>

---------

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>
Co-authored-by: Lamine Idjeraoui <lidjeraoui@apple.com>
fdesu pushed a commit to fdesu/OpenSearch that referenced this pull request Dec 13, 2025
* Fix flack test opensearch-project#18056

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>

* remove AwaitsFix annotation
update change log

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>

* use prepareCreate to merge with setup settings

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>

---------

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>
Co-authored-by: Lamine Idjeraoui <lidjeraoui@apple.com>
liuguoqingfz pushed a commit to liuguoqingfz/OpenSearch that referenced this pull request Dec 15, 2025
* Fix flack test opensearch-project#18056

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>

* remove AwaitsFix annotation
update change log

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>

* use prepareCreate to merge with setup settings

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>

---------

Signed-off-by: Lamine Idjeraoui <lidjeraoui@apple.com>
Co-authored-by: Lamine Idjeraoui <lidjeraoui@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working disabled-test Issues that are used by an AwaitsFix annotation to temporarily disable a broken test flaky-test Random test failure that succeeds on second run Indexing Indexing, Bulk Indexing and anything related to indexing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] ClusterMaxMergesAtOnceIT is flaky

3 participants