Skip to content

[ISSUE #11628] Add unit tests for FutureHolder task cancellation lifecycle - #11629

Open
coO-OO-O-co wants to merge 2 commits into
apache:developfrom
coO-OO-O-co:test/future-holder-lifecycle
Open

coO-OO-O-co wants to merge 2 commits into
apache:developfrom
coO-OO-O-co:test/future-holder-lifecycle

Conversation

@coO-OO-O-co

@coO-OO-O-co coO-OO-O-co commented Nov 26, 2026 •

Copy link
Copy Markdown

Which Issue(s) This PR Fixes

Fixes #11628

Brief Description

FutureHolder manages futures used by the scheduled statistics printers but lacks dedicated unit tests.

Add four tests covering:

  • Calling cancel(false) on all futures registered under a removed key.
  • Keeping futures under other keys unaffected and available for subsequent removal.
  • Handling missing keys and repeated removal without additional cancellation calls.
  • Registering and removing new futures under a previously removed key without cancelling the old futures again.

The tests use Mockito mocks without threads or sleeps. No production code is changed.

How Did You Test This Change?

Ran locally:

mvn -B -pl common -am clean test

Results:

  • common module: 353 tests, 0 failures, 0 errors, 0 skipped.
  • FutureHolderTest: 4 tests, 0 failures, 0 errors, 0 skipped.
  • BUILD SUCCESS.
  • Additional CI stabilization

The Windows CI run exposed a race in the existing
IndexStoreServiceTest.doCompactionTest between manual compaction
and the background worker.

This PR also isolates manual compaction from the background worker,
preserves cleanup, and checks both manual upload return values.
No production code is changed.

Validation of this additional fix:

The combined changes will be validated by CI on this PR.

@codecov-commenter

codecov-commenter commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.91%. Comparing base (e114b54) to head (209b7bd).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #11629      +/-   ##
=============================================
+ Coverage      50.86%   50.91%   +0.04%     
- Complexity     14881    14895      +14     
=============================================
  Files           1391     1391              
  Lines         103773   103773              
  Branches       13614    13614              
=============================================
+ Hits           52789    52839      +50     
+ Misses         44724    44675      -49     
+ Partials        6260     6259       -1     

☔ View full report in Codecov by Harness.
📢 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Add unit tests for FutureHolder task cancellation lifecycle

2 participants