Skip to content

test(indexing-service): migrate ingestion and parallel tests to JUnit 5 - #19926

Open
FrankChen021 wants to merge 5 commits into
apache:masterfrom
FrankChen021:codex/junit5-indexing-part2-ingestion-parallel
Open

test(indexing-service): migrate ingestion and parallel tests to JUnit 5#19926
FrankChen021 wants to merge 5 commits into
apache:masterfrom
FrankChen021:codex/junit5-indexing-part2-ingestion-parallel

Conversation

@FrankChen021

Copy link
Copy Markdown
Member

Summary

  • Migrate the ingestion-task and parallel-indexing tests in indexing-service to JUnit 5.
  • Replace JUnit 4 assertions, lifecycle annotations, rules, Hamcrest matchers, and temporary-folder APIs in this batch with Jupiter/AssertJ and Druid's existing temporary-directory utilities.
  • Add the Jupiter parameterized-test and Mockito Jupiter test dependencies required by the migrated tests.
  • Keep the remaining JUnit 4 lifecycle annotations in the shared IngestionTestBase only as a compatibility bridge for legacy tests outside this batch.
  • Keep this batch independent from the Task Actions/Compaction, common-support, Overlord, seekable-stream, and worker batches.

Validation

  • Two fresh focused reruns of ParallelIndexSupervisorTaskResourceTest: 1 test each, 0 failures/errors.
  • Test compilation passed.
  • Static module verification passed with Checkstyle, PMD, Enforcer, forbidden APIs, packaging, and install.
  • Legacy/prohibited usage scans and git diff --check passed.

Tracking

Part of #13948.

Related migration PRs: #19910, #19920, #19922, #19923, and #19925.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request continues the indexing-service JUnit 4 → JUnit 5 migration by updating ingestion-task and parallel-indexing test suites to JUnit Jupiter, modernizing assertions/lifecycle APIs, and aligning temporary-directory handling with Druid utilities.

Changes:

  • Migrated ingestion/parallel-indexing tests from JUnit 4 to JUnit 5 (Jupiter annotations, assertions, parameterization, and timeout handling).
  • Replaced JUnit 4 Rules (e.g., TemporaryFolder, ExpectedException, TestName, runner-based parameterization) with Jupiter equivalents and Druid FileUtils temp-dir utilities.
  • Added junit-jupiter-params and mockito-junit-jupiter test dependencies to support parameterized tests and Mockito Jupiter integration.

Reviewed changes

Copilot reviewed 63 out of 63 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
indexing-service/src/test/java/org/apache/druid/indexing/common/task/ShardSpecsTest.java Switch assertions/annotations to JUnit Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/RestoreTaskTest.java Replace JUnit 4 assertions with Jupiter assertions.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/RangePartitionCachingLocalSegmentAllocatorTest.java Replace ExpectedException rule with assertThrows; migrate lifecycle annotations.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/MoveTaskTest.java Replace JUnit 4 assertions with Jupiter assertions.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/InputRowFilterTest.java Migrate assertions and imports to JUnit Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/IngestionTestBase.java Replace TemporaryFolder rule with FileUtils-managed temp dirs; add Jupiter lifecycle; keep JUnit 4 lifecycle annotations for bridge compatibility.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/IndexTaskUtilsTest.java Migrate Mockito runner to Mockito Jupiter extension; switch to Jupiter assertions/lifecycle.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/IndexTaskSerdeTest.java Replace ExpectedException rule with assertThrows; migrate to Jupiter lifecycle and assertions.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/concurrent/ConcurrentReplaceAndStreamingAppendTest.java Migrate per-test setup/teardown to Jupiter; keep IngestionTestBase integration.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/ClientKillUnusedSegmentsTaskQuerySerdeTest.java Migrate to Jupiter lifecycle and assertions.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/TombstoneHelperTest.java Replace JUnit 4 assertions with Jupiter assertions.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/TaskMonitorTest.java Migrate setup/teardown and assertions to JUnit Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseSubTaskSpecTest.java Migrate lifecycle and assertions to JUnit Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseParallelIndexingTest.java Convert parameterized-runner usage to Jupiter class parameterization; update temp dir handling and assumptions.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/SegmentAllocationRequestTest.java Replace JUnit 4 assertions with Jupiter assertions.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionTaskKillTest.java Replace JUnit 4 timeouts with @Timeout; migrate lifecycle/assertions and temp dirs.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionMultiPhaseParallelIndexingTest.java Convert runner-based parameterization and Hamcrest assertions to Jupiter APIs; use createTempDir helpers.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionAdjustingCorePartitionSizeTest.java Convert parameterized runner to Jupiter class parameterization; replace temp folder usage.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PushedSegmentsReportTest.java Update to JUnit Jupiter @Test.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PerfectRollupWorkerTaskTest.java Replace ExpectedException rule with assertThrows; migrate to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialSegmentMergeIOConfigTest.java Convert parameterized runner to Jupiter class parameterization; migrate lifecycle.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialSegmentMergeIngestionSpecTest.java Convert parameterized runner to Jupiter class parameterization; migrate lifecycle/parameter injection.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialRangeSegmentGenerateTaskTest.java Replace ExpectedException rule with assertThrows; migrate assertions to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialHashSegmentGenerateTaskTest.java Replace Hamcrest and ExpectedException with Jupiter assertions and assertThrows.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialGenericSegmentMergeTaskTest.java Convert parameterized runner to Jupiter class parameterization; replace ExpectedException with assertThrows.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionDistributionTaskTest.java Replace rule-based temp dirs/exception/log capture with explicit Jupiter lifecycle + FileUtils; migrate assertions.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionCardinalityTaskTest.java Same migration pattern as distribution test: Jupiter lifecycle + FileUtils, assertThrows, and updated assertions.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialCompactionTest.java Migrate lifecycle/assertions and temp directory creation to Jupiter + helpers.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexTuningConfigTest.java Replace ExpectedException rule with assertThrows; migrate to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTaskTest.java Convert nested parameterized runner usage and Hamcrest checks to Jupiter parameterization and assertions.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTaskSerdeTest.java Replace ExpectedException rule with assertThrows; migrate assertions to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTaskResourceTest.java Replace JUnit 4 timeout and teardown with @Timeout/@AfterEach; migrate assertions to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTaskKillTest.java Replace timeouts and teardown with Jupiter @Timeout/@AfterEach; migrate assertions to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexPhaseRunnerTest.java Migrate lifecycle/temp dirs and assertions to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/MultiPhaseParallelIndexingWithNullColumnTest.java Convert parameterized runner usage to Jupiter class parameterization; migrate assertions.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/MultiPhaseParallelIndexingRowStatsTest.java Replace @Ignore with @Disabled; migrate lifecycle to Jupiter; use temp-dir helper.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/iterator/RangePartitionIndexTaskInputRowIteratorBuilderTest.java Replace Hamcrest + ExpectedException with Jupiter assertions and assertThrows.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/iterator/IndexTaskInputRowIteratorBuilderTestingFactory.java Switch assertion import to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/iterator/DefaultIndexTaskInputRowIteratorBuilderTest.java Replace rule-based exceptions with assertThrows; migrate assertions to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HttpShuffleClientTest.java Replace temp-folder rule with FileUtils temp dirs + @AfterEach; migrate exception checks to assertThrows.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionTaskKillTest.java Replace timeouts with @Timeout; migrate setup/assertions and temp dirs.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionMultiPhaseParallelIndexingTest.java Convert parameterized runner usage to Jupiter class parameterization; migrate assertions and temp dirs.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionCachingLocalSegmentAllocatorTest.java Migrate lifecycle and assertions to JUnit Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionAdjustingCorePartitionSizeTest.java Convert parameterized runner usage to Jupiter class parameterization; migrate assertions and temp dirs.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/GenericPartitionStatTest.java Migrate lifecycle and assertions to JUnit Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/GenericPartitionLocationTest.java Migrate lifecycle and assertions to JUnit Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/distribution/StringSketchTest.java Replace Hamcrest + ExpectedException with Jupiter assertions and assertThrows.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/distribution/StringSketchMergerTest.java Replace ExpectedException rule with assertThrows; migrate lifecycle to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/distribution/ArrayOfStringTuplesSerDeTest.java Migrate JUnit 4 assertions to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/distribution/ArrayOfStringsNullSafeSerdeTest.java Migrate assertions and assertThrows usage to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/DimensionDistributionReportTest.java Migrate lifecycle annotations to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/DimensionCardinalityReportTest.java Replace logger rule with explicit lifecycle management; migrate assertions to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/DeepStorageShuffleClientTest.java Replace temp-folder rule with FileUtils temp dirs + @AfterEach; migrate assertions.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/DeepStoragePartitionStatTest.java Migrate lifecycle and assertions to JUnit Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/DeepStoragePartitionLocationTest.java Migrate lifecycle and assertions to JUnit Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/AbstractParallelIndexSupervisorTaskTest.java Replace JUnit 4 rules (TemporaryFolder, TestName) with FileUtils temp dirs and TestInfo; migrate lifecycle to Jupiter.
indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/AbstractMultiPhaseParallelIndexingTest.java Migrate assertions to Jupiter (message/order adjustments).
indexing-service/src/test/java/org/apache/druid/indexing/common/task/ArchiveTaskTest.java Replace JUnit 4 assertions with Jupiter assertions.
indexing-service/pom.xml Add junit-jupiter-params and mockito-junit-jupiter test dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@FrankChen021 FrankChen021 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

reviewed all changes made by codex, LGTM

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants