Skip to content

test: migrate extensions-core and processing tests to JUnit 5 - #19875

Open
FrankChen021 wants to merge 12 commits into
apache:masterfrom
FrankChen021:codex/junit5-migration-ext-core-1
Open

test: migrate extensions-core and processing tests to JUnit 5#19875
FrankChen021 wants to merge 12 commits into
apache:masterfrom
FrankChen021:codex/junit5-migration-ext-core-1

Conversation

@FrankChen021

@FrankChen021 FrankChen021 commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

Migrate the selected tests in these ten extensions-core modules to JUnit 5:

  • druid-aws-rds-extensions
  • druid-bloom-filter
  • druid-kerberos
  • druid-pac4j
  • ec2-extensions
  • kafka-extraction-namespace
  • mysql-metadata-storage
  • orc-extensions
  • postgresql-metadata-storage
  • testing-tools

The changes replace JUnit 4 annotations, assertions, parameterized runners, and temporary-folder usage with Jupiter APIs and the approved temporary-directory helpers. The module test POMs are updated with the Jupiter and Mockito-Jupiter dependencies required by the migrated tests, and direct JUnit 4/Vintage dependencies are removed where this batch no longer needs them.

The following compatibility dependencies or usages remain intentionally in this PR:

  • druid-bloom-filter retains junit:junit and org.hamcrest:hamcrest because shared processing/SQL test-jar fixture APIs expose those types.
  • kafka-extraction-namespace still uses Hamcrest in TestKafkaExtractionCluster.
  • testing-tools retains junit-jupiter-migrationsupport.
  • mysql-metadata-storage retains its existing Hamcrest test dependency.

This PR contains no processing, SQL, server, benchmark, or extensions-contrib fixture migration.

Validation

  • All current GitHub Actions checks passed, including strict compilation, packaging, web checks, OpenRewrite, Maven static checks, unit/integration tests, coverage, Docker tests, and CodeQL.
  • The Bloom filter test suite passed locally with 80 tests and only existing skips.
  • Pac4jSessionStoreTest passed locally with 12 tests and no failures or errors.
  • Checkstyle, PMD, Enforcer, forbidden-API checks, and git diff --check passed.

Release note

Test-only change; there is no user-facing behavior change.

Tracking

Part of #13948.

@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 40 of 40 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 40 of 40 changed files. The prior task.json filename finding is resolved: all four fixtures now create the exact path required by CliPeon.


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

@clintropolis

Copy link
Copy Markdown
Member

i have a branch migrating all of the BaseFilterTest tests (including the bloom filter test) to junit5, part of this series of PRs i've been doing #19601, will try to push it up today so this one doesn't need to use a weird bridge. Thanks for helping out getting stuff converted, will try to have a look at some of these soon.

@clintropolis

Copy link
Copy Markdown
Member

i have a branch migrating all of the BaseFilterTest tests

PR is up, #19882

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

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

Migrates an initial set of extensions-core tests from JUnit 4 to JUnit 5 (Jupiter), while adding JUnit 5–compatible temp-directory support in processing test helpers and updating extension module POMs to drop unneeded JUnit 4/Vintage dependencies where possible.

Changes:

  • Migrated multiple extension test classes from JUnit 4 annotations/rules/runners to JUnit Jupiter equivalents (including parameterized tests and @TempDir).
  • Added temp-directory factory support to processing’s test-only AggregationTestHelper to avoid TemporaryFolder in migrated tests.
  • Updated several extension module POMs to use Jupiter dependencies and remove JUnit 4/Vintage where no longer required.

Reviewed changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
processing/src/test/java/org/apache/druid/query/aggregation/AggregationTestHelper.java Introduces a temp-folder provider abstraction and new factory methods that accept a File temp root for Jupiter-friendly temp dir creation.
extensions-core/testing-tools/src/test/java/org/apache/druid/query/expressions/SleepExprTest.java Migrates assertions to Jupiter.
extensions-core/testing-tools/src/test/java/org/apache/druid/guice/ClusterTestingModuleTest.java Migrates from TemporaryFolder rule to @TempDir and updates assertions to Jupiter.
extensions-core/testing-tools/pom.xml Removes JUnit 4 + Vintage dependencies and relies on Jupiter artifacts for tests.
extensions-core/postgresql-metadata-storage/src/test/java/org/apache/druid/metadata/storage/postgresql/PostgreSQLConnectorTest.java Converts JUnit 4 parameterized runner usage to Jupiter parameterized tests.
extensions-core/postgresql-metadata-storage/src/test/java/org/apache/druid/metadata/input/PostgresqlInputSourceDatabaseConnectorTest.java Replaces ExpectedException rule with Jupiter assertThrows-based assertions.
extensions-core/postgresql-metadata-storage/pom.xml Switches test dependencies from JUnit 4 to Jupiter (api/engine/params).
extensions-core/orc-extensions/src/test/java/org/apache/druid/data/input/orc/OrcStructConverterTest.java Migrates assertions to Jupiter.
extensions-core/orc-extensions/src/test/java/org/apache/druid/data/input/orc/OrcReaderTest.java Migrates to Jupiter and replaces TemporaryFolder with @TempDir + helper for temp subfolders.
extensions-core/orc-extensions/src/test/java/org/apache/druid/data/input/orc/OrcInputFormatTest.java Migrates lifecycle annotation from @Before to @BeforeEach and assertions to Jupiter.
extensions-core/orc-extensions/pom.xml Switches test dependencies from JUnit 4 to Jupiter (api/engine).
extensions-core/mysql-metadata-storage/src/test/java/org/apache/druid/metadata/storage/mysql/MySQLMetadataStorageModuleTest.java Migrates assertions to Jupiter.
extensions-core/mysql-metadata-storage/src/test/java/org/apache/druid/metadata/storage/mysql/MySQLConnectorTest.java Converts JUnit 4 parameterized runner usage to Jupiter parameterized tests.
extensions-core/mysql-metadata-storage/src/test/java/org/apache/druid/metadata/storage/mysql/MySQLConnectorDriverConfigTest.java Migrates to Jupiter @Test.
extensions-core/mysql-metadata-storage/src/test/java/org/apache/druid/metadata/input/MySQLInputSourceDatabaseConnectorTest.java Migrates Mockito JUnit4 runner usage to Jupiter extension and replaces ExpectedException with assertThrows.
extensions-core/mysql-metadata-storage/pom.xml Switches test dependencies from JUnit 4 to Jupiter and adds mockito-junit-jupiter.
extensions-core/kafka-extraction-namespace/src/test/java/org/apache/druid/query/lookup/TestKafkaExtractionCluster.java Migrates to Jupiter lifecycle annotations, @TempDir, and @Timeout.
extensions-core/kafka-extraction-namespace/src/test/java/org/apache/druid/query/lookup/KafkaLookupExtractorFactoryTest.java Migrates to Jupiter @BeforeEach and assertions.
extensions-core/kafka-extraction-namespace/pom.xml Switches test dependencies from JUnit 4 to Jupiter (api/engine).
extensions-core/ec2-extensions/src/test/java/org/apache/druid/indexing/overlord/setup/WorkerBehaviorConfigTest.java Migrates assertions to Jupiter.
extensions-core/ec2-extensions/src/test/java/org/apache/druid/indexing/overlord/autoscaling/ec2/EC2NodeDataTest.java Migrates assertions to Jupiter.
extensions-core/ec2-extensions/src/test/java/org/apache/druid/indexing/overlord/autoscaling/ec2/EC2AutoScalerTest.java Migrates lifecycle annotations and assertions to Jupiter.
extensions-core/ec2-extensions/src/test/java/org/apache/druid/indexing/overlord/autoscaling/ec2/EC2AutoScalerSerdeTest.java Migrates assertions to Jupiter.
extensions-core/ec2-extensions/pom.xml Switches test dependencies from JUnit 4 to Jupiter (api/engine).
extensions-core/druid-pac4j/src/test/java/org/apache/druid/security/pac4j/Pac4jSessionStoreTest.java Migrates assertions to Jupiter.
extensions-core/druid-pac4j/src/test/java/org/apache/druid/security/pac4j/Pac4jFilterTest.java Migrates Mockito JUnit4 runner usage to Jupiter extension and converts lifecycle annotations/assertions.
extensions-core/druid-pac4j/src/test/java/org/apache/druid/security/pac4j/Pac4jCommonConfigTest.java Migrates assertions to Jupiter.
extensions-core/druid-pac4j/src/test/java/org/apache/druid/security/pac4j/OIDCConfigTest.java Migrates assertions to Jupiter.
extensions-core/druid-pac4j/src/test/java/org/apache/druid/security/pac4j/JwtAuthenticatorTest.java Migrates assertions to Jupiter.
extensions-core/druid-pac4j/pom.xml Switches test dependencies from JUnit 4 to Jupiter and adds mockito-junit-jupiter.
extensions-core/druid-kerberos/src/test/java/org/apache/druid/security/kerberos/KerberosUtilTest.java Migrates assertions to Jupiter.
extensions-core/druid-kerberos/src/test/java/org/apache/druid/security/kerberos/KerberosAuthenticatorTest.java Migrates assertThrows + assertions to Jupiter.
extensions-core/druid-kerberos/pom.xml Switches test dependencies from JUnit 4 to Jupiter (api/engine).
extensions-core/druid-bloom-filter/src/test/java/org/apache/druid/query/filter/BloomKFilterTest.java Migrates assertions to Jupiter.
extensions-core/druid-bloom-filter/src/test/java/org/apache/druid/query/filter/BloomDimFilterTest.java Migrates to Jupiter (including class-level parameterization) and updates lifecycle hooks.
extensions-core/druid-bloom-filter/src/test/java/org/apache/druid/query/expressions/BloomFilterExpressionsTest.java Replaces ExpectedException rule with Jupiter assertThrows-based assertions.
extensions-core/druid-bloom-filter/src/test/java/org/apache/druid/query/aggregation/bloom/BloomFilterGroupByQueryTest.java Migrates parameterization to Jupiter and moves temp-dir usage to AggregationTestHelper temp root support.
extensions-core/druid-bloom-filter/src/test/java/org/apache/druid/query/aggregation/bloom/BloomFilterAggregatorTest.java Migrates assertions to Jupiter.
extensions-core/druid-bloom-filter/src/test/java/org/apache/druid/query/aggregation/bloom/BloomFilterAggregatorFactoryTest.java Migrates assertions to Jupiter.
extensions-core/druid-bloom-filter/pom.xml Updates test dependencies to include Jupiter artifacts and other test libs used by the module.
extensions-core/druid-aws-rds-extensions/src/test/java/org/apache/druid/aws/rds/AWSRDSTokenPasswordProviderTest.java Migrates assertions to Jupiter.
extensions-core/druid-aws-rds-extensions/pom.xml Switches test dependencies from JUnit 4 to Jupiter (api/engine).

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

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

Reviewed 42 of 42 changed files. The prior task.json filename issue remains resolved, and the newer Bloom lifecycle and unique temporary-directory fixes are sound.


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

@FrankChen021
FrankChen021 force-pushed the codex/junit5-migration-ext-core-1 branch from 816c2b0 to aa26af0 Compare August 6, 2026 12:28

@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, JUnit lifecycle behavior, parameterization, temporary-directory handling, and integration risks; no issues found.

Reviewed 42 of 42 changed files.

The latest null-safe teardown, assertion-order corrections, and naming cleanup are sound. Targeted verification passed all 20 invocations across BloomFilterGroupByQueryTest, EC2AutoScalerTest, and SleepExprTest; dev/validate-junit5-usage and git diff --check also passed.


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

@FrankChen021

Copy link
Copy Markdown
Member Author

manually review all changes, 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.

4 participants