Skip to content

test: migrate extension-core google kafka and lookup tests to JUnit 5 - #19878

Merged
FrankChen021 merged 8 commits into
apache:masterfrom
FrankChen021:codex/junit5-migration-ext-core-4
Aug 5, 2026
Merged

test: migrate extension-core google kafka and lookup tests to JUnit 5#19878
FrankChen021 merged 8 commits into
apache:masterfrom
FrankChen021:codex/junit5-migration-ext-core-4

Conversation

@FrankChen021

@FrankChen021 FrankChen021 commented Aug 4, 2026

Copy link
Copy Markdown
Member

Description

Migrates the Google extensions, Kafka indexing service, and cached-global lookup extension tests from JUnit 4 to JUnit 5.

This is part of #13948 and follows #19875, #19876, and #19877.

The migration preserves parameterized-test setup and per-test lifecycle behavior, including the Derby-backed JDBC lookup tests and temporary-file fixtures.

Modules

  • extensions-core/google-extensions
  • extensions-core/kafka-indexing-service
  • extensions-core/lookups-cached-global

Transitional dependency

The migrated Kafka test class is Jupiter-only. Its module temporarily retains junit:junit because the shared indexing-service test-jar superclass still exposes JUnit 4 TemporaryFolder and Derby rule types. That shared stream-ingestion fixture will be removed in the coordinated Kinesis/Kafka follow-up.

Testing

  • mvn -ntp -pl extensions-core/kafka-indexing-service -am -DskipTests -Dweb.console.skip=true -Pskip-static-checks -T1C test-compile: BUILD SUCCESS.
  • KafkaIndexTaskTest#testKafkaTaskContainsAllTaskDimensions: 2 parameterized invocations passed after restoring the shared CliPeonTest fixture.
  • A prior full Kafka execution reached 92 parameterized invocations; the only remaining failure was the existing FileTaskLogs payload-provisioning error. A subsequent full rerun was blocked locally because Testcontainers could not find Docker.
  • git diff --check passed.

@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.

Severity Findings
P0 0
P1 1
P2 0
P3 0
Total 1
Severity Findings
P0 0
P1 1
P2 0
P3 0
Total 1

Reviewed 52 of 52 changed files.


This is an automated review by Codex GPT-5.6-Sol

@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.

I have reviewed the updated code for correctness, edge cases, concurrency, and integration risks; no issues found.

Reviewed 52 of 52 changed files. The prior test-discovery finding is resolved: all 70 KafkaSupervisorTest methods again have Jupiter @Test annotations.


This is an automated review by Codex GPT-5.6-Sol

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@FrankChen021
FrankChen021 marked this pull request as ready for review August 5, 2026 01:54
Copilot AI lite review requested due to automatic review settings August 5, 2026 01:54

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 PR migrates unit tests in the extensions-core/google-extensions, extensions-core/kafka-indexing-service, and extensions-core/lookups-cached-global modules from JUnit 4 to JUnit 5 (Jupiter), updating lifecycle hooks, parameterized tests, exception assertions, and temp-directory handling while preserving existing test behavior (including Derby-backed JDBC lookup coverage).

Changes:

  • Convert JUnit 4 annotations/rules/runners (e.g., @Before/@After, TemporaryFolder, @RunWith(Parameterized.class), ExpectedException) to JUnit 5 equivalents (@BeforeEach/@AfterEach, @TempDir, @ParameterizedTest + @MethodSource, assertThrows, @Timeout).
  • Adjust test fixtures to work under Jupiter (e.g., custom Derby extension, temp-dir helpers using FileUtils.createTempDirInLocation).
  • Update module POMs to depend on JUnit Jupiter artifacts needed by migrated tests.

Reviewed changes

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

Show a summary per file
File Description
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/UriCacheGeneratorTest.java Migrate parameterized/cache generator tests to JUnit 5 with @TempDir, @ParameterizedTest, and @Timeout.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/StaticMapCacheGeneratorTest.java Convert assertions and expected-exception test to assertThrows under Jupiter.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/NamespacedExtractorModuleTest.java Replace TemporaryFolder with @TempDir and update assertions to Jupiter.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/JdbcCacheGeneratorTest.java Migrate ExpectedException usage to assertThrows + message checks.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OnHeapNamespaceExtractionCacheManagerTest.java Switch to Jupiter assertions (including Assertions.assertThrows).
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OffHeapNamespaceExtractionCacheManagerTest.java Switch to Jupiter assertions.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/NamespaceExtractionCacheManagersTest.java Convert parameterized cache-manager tests to @ParameterizedTest + @MethodSource with Jupiter timeouts.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/JdbcExtractionNamespaceTest.java Migrate Derby-backed JDBC namespace tests to Jupiter; introduce a per-test Derby extension and Jupiter parameterization.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/CacheSchedulerTest.java Convert cache scheduler parameterized tests to JUnit 5 with @TempDir and @ParameterizedTest.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/NamespaceLookupExtractorFactoryTest.java Convert temp-folder use to @TempDir and migrate assertions/expected exceptions to Jupiter.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/namespace/UriExtractionNamespaceTest.java Convert expected-exception tests to assertThrows and update assertions to Jupiter.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/namespace/StaticMapExtractionNamespaceTest.java Replace @BeforeClass with @BeforeAll and migrate assertions to Jupiter.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/namespace/JSONFlatDataParserTest.java Replace TemporaryFolder/ExpectedException with @TempDir + assertThrows and migrate assertions.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/namespace/JdbcExtractionNamespaceUrlCheckTest.java Convert nested rule-based tests to Jupiter @Nested classes and assertThrows.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/LookupUtilsTest.java Update lifecycle annotation and assertions to Jupiter.
extensions-core/lookups-cached-global/src/test/java/org/apache/druid/data/input/MapPopulatorTest.java Switch assertions to Jupiter.
extensions-core/lookups-cached-global/pom.xml Replace JUnit 4 dependency with JUnit Jupiter test dependencies.
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorTuningConfigTest.java Migrate assertions to Jupiter.
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorSpecTest.java Switch to Jupiter assertions while keeping Hamcrest assertThat; migrate assertThrows.
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaSeekableStreamStartSequenceNumbersTest.java Migrate assertions to Jupiter and preserve serde/back-compat checks.
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaSeekableStreamEndSequenceNumbersTest.java Migrate assertions to Jupiter and preserve serde/back-compat checks.
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaSamplerSpecTest.java Convert class lifecycle annotations to @BeforeAll/@AfterAll and replace ExpectedException with assertThrows.
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaRecordSupplierTest.java Convert lifecycle hooks to Jupiter and migrate exception tests to assertThrows.
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaIOConfigTest.java Replace ExpectedException with a Jupiter helper around JsonMappingException assertions.
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaIndexTaskTuningConfigTest.java Migrate assertions to Jupiter and preserve serde behavior coverage.
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaCheckpointDataSourceMetadataSerdeTest.java Convert @Before to @BeforeEach and migrate assertions to Jupiter.
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/data/input/kafkainput/KafkaStringHeaderFormatTest.java Migrate assertions to Jupiter.
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/data/input/kafkainput/KafkaInputFormatTest.java Convert setup to @BeforeEach and migrate assertions/throws checks to Jupiter.
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/data/input/kafka/KafkaTopicPartitionTest.java Convert setup to @BeforeEach and migrate assertions to Jupiter.
extensions-core/kafka-indexing-service/pom.xml Add JUnit Jupiter dependencies and drop Vintage engine for this module.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/output/GoogleStorageConnectorTest.java Migrate to Jupiter and replace TemporaryFolder with @TempDir + helper folder creation.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/output/GoogleStorageConnectorProviderTest.java Migrate assertions and expected exceptions to Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/output/GoogleOutputConfigTest.java Replace TemporaryFolder rule with @TempDir and migrate assertThrows usage to Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/output/GoogleInputRangeTest.java Switch to Jupiter @Test.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/output/GoogleExportStorageProviderTest.java Migrate assertions and exception checks to Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/ObjectStorageIteratorTest.java Migrate assertions to Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleUtilsTest.java Migrate retryability assertions to Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleTimestampVersionedDataFinderTest.java Migrate assertions to Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleTaskLogsTest.java Convert setup to @BeforeEach and migrate assertions to Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleStorageTest.java Convert setup to @BeforeEach and migrate assertions/static imports to Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleStorageDruidModuleTest.java Migrate assertions to Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleDataSegmentPusherTest.java Replace TemporaryFolder rule with @TempDir and migrate assertions to Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleDataSegmentPullerTest.java Convert expected-exception style to assertThrows and migrate assertions to Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleDataSegmentKillerTest.java Convert setup to @BeforeEach and migrate exception assertions to Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/GoogleByteSourceTest.java Convert expected-exception test to assertThrows under Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/data/input/google/GoogleCloudStorageInputSourceTest.java Replace ExpectedException rule with assertThrows and migrate assertions to Jupiter.
extensions-core/google-extensions/src/test/java/org/apache/druid/data/input/google/GoogleCloudStorageInputSourceFactoryTest.java Convert expected-exception test to assertThrows and migrate assertions to Jupiter.
extensions-core/google-extensions/pom.xml Replace JUnit 4 dependency with JUnit Jupiter test dependencies.
Suppressed comments (1)

extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/JdbcCacheGeneratorTest.java:105

  • Code style: AGENTS.md requires using final for locals that are not reassigned. These new locals can be final to match the project convention.

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

@FrankChen021
FrankChen021 merged commit 6805922 into apache:master Aug 5, 2026
28 checks passed
@FrankChen021
FrankChen021 deleted the codex/junit5-migration-ext-core-4 branch August 5, 2026 11:52
@github-actions github-actions Bot added this to the 39.0.0 milestone Aug 5, 2026
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.

4 participants