Skip to content

test: migrate histogram extension tests to JUnit 5 - #19879

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

test: migrate histogram extension tests to JUnit 5#19879
FrankChen021 merged 6 commits into
apache:masterfrom
FrankChen021:codex/junit5-migration-ext-core-5

Conversation

@FrankChen021

Copy link
Copy Markdown
Member

Description

Migrates the extensions-core/histogram test suite from JUnit 4 to JUnit 5.

This is Batch 5 of the extensions-core migration and is part of #13948.

Depends on the earlier migration batches in #19875, #19876, #19877, and #19878.

The shared AggregationTestHelper now also accepts a JUnit 5 @TempDir directory while retaining the existing JUnit 4-compatible API for remaining migration batches.

Tests

mvn -ntp test -pl extensions-core/histogram -am \
  -Dtest='org.apache.druid.query.aggregation.histogram.**' \
  -Dsurefire.failIfNoSpecifiedTests=false \
  -Pskip-static-checks -Dweb.console.skip=true -T1C

Result: 211 tests passed; 0 failures, errors, or skips.

@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 code for correctness, edge cases, concurrency, and integration risks; no issues found.

Reviewed 26 of 26 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 26 of 26 changed files. The shared temporary-folder helper update preserves both legacy and Jupiter callers.


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

@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 continues the extensions-core JUnit 4 → JUnit 5 migration by converting the extensions-core/histogram test suite to Jupiter, while updating the shared AggregationTestHelper (in processing test fixtures) to support JUnit 5 @TempDir-style temp directories in addition to the existing JUnit 4 TemporaryFolder API.

Changes:

  • Update AggregationTestHelper to abstract temp-directory creation behind a provider and add JUnit 5-friendly WithTempDir factory methods.
  • Migrate histogram extension tests from JUnit 4 annotations/rules/assertions to JUnit 5 (Jupiter) equivalents, including parameterized test conversions.
  • Remove the JUnit Vintage engine dependency from the histogram module.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 4 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 adds JUnit 5 @TempDir-compatible helper factory methods.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/QuantilesTest.java Switches to Jupiter assertions and updates Hamcrest usage.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/QuantilesPostAggregatorTest.java Migrates assertions and expected-exception rule to Jupiter assertThrows.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/QuantilePostAggregatorTest.java Migrates to Jupiter assertions.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/MinPostAggregatorTest.java Migrates to Jupiter assertions.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/MaxPostAggregatorTest.java Migrates to Jupiter assertions.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramVectorAggregatorTest.java Migrates lifecycle annotations to Jupiter and replaces JUnit 4 asserts.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramTopNQueryTest.java Converts from JUnit4 Parameterized runner to Jupiter parameterized tests.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramTest.java Migrates to Jupiter assertions.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramGroupByQueryTest.java Converts from JUnit4 Parameterized runner and expected-exception style to Jupiter parameterized tests + assertThrows.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramBufferAggregatorTest.java Migrates to Jupiter assertions and modernizes assertion message placement.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramAggregationTest.java Moves temp-dir handling from TemporaryFolder rule to Jupiter @TempDir with updated helper factory.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/EqualBucketsPostAggregatorTest.java Migrates to Jupiter assertions.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/CustomBucketsPostAggregatorTest.java Migrates to Jupiter assertions.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/BucketsPostAggregatorTest.java Migrates to Jupiter assertions.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ArrayUtilsTest.java Migrates to Jupiter assertions.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramVectorAggregatorTest.java Migrates lifecycle annotations to Jupiter and replaces JUnit 4 asserts.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramTopNQueryTest.java Converts from JUnit4 Parameterized runner to Jupiter parameterized tests.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramTest.java Migrates to Jupiter assertions and converts @Ignore to @Disabled.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramPostAggregatorTest.java Migrates to Jupiter assertions.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramGroupByQueryTest.java Converts from JUnit4 Parameterized runner and expected-exception style to Jupiter parameterized tests + assertThrows.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramFoldingVectorAggregatorTest.java Migrates lifecycle annotations to Jupiter and replaces JUnit 4 asserts.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramFoldingSerdeTest.java Migrates to Jupiter assertions and updates assertion message placement.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramAggregatorTest.java Migrates to Jupiter assertions and updates assertion message placement.
extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramAggregationTest.java Moves temp-dir handling from TemporaryFolder rule to Jupiter @TempDir with updated helper factory.
extensions-core/histogram/pom.xml Removes the JUnit Vintage engine dependency for the module.

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

Comment on lines 64 to 68
private QueryRunner runner;

public FixedBucketsHistogramTopNQueryTest(
public void initFixedBucketsHistogramTopNQueryTest(
QueryRunner runner
)

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.

Thanks for flagging this. This was actionable and is already addressed by commit 1eb26ec9d8: the redundant runner field and initFixedBucketsHistogramTopNQueryTest method were removed, and the parameterized test uses its runner argument directly. The four affected histogram test classes passed (80 tests, 0 failures), with Checkstyle and SpotBugs reporting 0 violations/errors.

Comment on lines 65 to 69
private QueryRunner runner;

public ApproximateHistogramTopNQueryTest(
public void initApproximateHistogramTopNQueryTest(
QueryRunner runner
)

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.

Thanks for flagging this. This was actionable and is already addressed by commit 1eb26ec9d8: the redundant runner field and initApproximateHistogramTopNQueryTest method were removed, and the parameterized test uses its runner argument directly. The four affected histogram test classes passed (80 tests, 0 failures), with Checkstyle and SpotBugs reporting 0 violations/errors.

Comment on lines 60 to 62
private QueryRunner<ResultRow> runner;
private GroupByQueryRunnerFactory factory;

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.

Thanks for flagging this. This was actionable and is already addressed by commit 1eb26ec9d8: the unused instance factory/runner fields and initFixedBucketsHistogramGroupByQueryTest method were removed. The parameterized method still receives the feeder values and uses the runner argument; SerDe registration is now performed directly in each test body. The four affected histogram test classes passed (80 tests, 0 failures), with Checkstyle and SpotBugs reporting 0 violations/errors.

Comment on lines 60 to 62
private QueryRunner<ResultRow> runner;
private GroupByQueryRunnerFactory factory;

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.

Thanks for flagging this. This was actionable and is already addressed by commit 1eb26ec9d8: the unused instance factory/runner fields and initApproximateHistogramGroupByQueryTest method were removed. The parameterized method still receives the feeder values and uses the runner argument; SerDe registration is now performed directly in each test body. The four affected histogram test classes passed (80 tests, 0 failures), with Checkstyle and SpotBugs reporting 0 violations/errors.

@MethodSource("constructorFeeder")
@ParameterizedTest(name = "{0}")
public void testGroupByWithApproximateHistogramAgg(
String testName,
@MethodSource("constructorFeeder")
@ParameterizedTest(name = "{0}")
public void testGroupByWithSameNameComplexPostAgg(
String testName,
@MethodSource("constructorFeeder")
@ParameterizedTest(name = "{0}")
public void testGroupByWithFixedHistogramAgg(
String testName,
@MethodSource("constructorFeeder")
@ParameterizedTest(name = "{0}")
public void testGroupByWithSameNameComplexPostAgg(
String testName,

@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 26 of 26 changed files. The incremental cleanup preserves method-source argument shapes and test setup, with test-annotation counts unchanged.


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

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