Skip to content

test(processing): migrate query tests to JUnit 5 - #19980

Open
FrankChen021 wants to merge 2 commits into
apache:masterfrom
FrankChen021:codex/junit5-processing-batch4
Open

test(processing): migrate query tests to JUnit 5#19980
FrankChen021 wants to merge 2 commits into
apache:masterfrom
FrankChen021:codex/junit5-processing-batch4

Conversation

@FrankChen021

Copy link
Copy Markdown
Member

Summary

  • Migrate Batch 4 processing query and aggregation tests to current JUnit 5 APIs and extensions.
  • Preserve shared Hamcrest matcher APIs, fixture factory behavior, and the existing processing JUnit 4/Vintage/Hamcrest dependencies.
  • Add the current JupiterAssertions and ExpectThrows adapters required by the exact migration base.

Scope

  • 74 assigned Java files under processing/src/test/java/org/apache/druid/query, plus the two current test adapters.
  • Covers aggregation and the remaining processing query families.
  • Leaves NestedDataTestUtils.java, GroupByQueryRunnerTestHelper.java, processing/pom.xml, excluded filter tests, and expression tests unchanged.
  • No duplicate org.apache.druid.testing.matchers framework or CI automation added.

Resolves #13948

Checks

  • mvn -ntp -pl processing -am -DskipTests -Dweb.console.skip=true -T1C test-compile — passed with Checkstyle, PMD, main/test forbidden-API scans, and compilation.
  • Focused aggregation/failure tests — 134 passed.
  • Focused GroupBy parameterized cases — 208 passed.
  • Focused Unnest GroupBy case — 1 passed.
  • Focused Timeseries parameterized cases — 52 passed.
  • Focused MultiValuedDimension parameterized cases — 32 passed.
  • mvn -ntp -pl processing -am -DskipTests -Dweb.console.skip=true -T1C spotbugs:check — passed with zero SpotBugs bugs/errors.

Copilot AI lite review requested due to automatic review settings August 12, 2026 05:23

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@FrankChen021

Copy link
Copy Markdown
Member Author

Addressed the CodeQL findings in commit c86509a: added explicit guards before all four lastResult dereferences; replaced all seven deprecated ColumnAnalysis.getType() calls in SegmentAnalyzerTest with type-signature APIs (using getComplexTypeName where the expected complex name is required); and removed the deprecated ScanQuery.isLegacy() call while retaining the legacy=false serde assertion. Focused tests pass. The current token cannot execute GitHub inline review replies or resolveReviewThread, so this top-level response records the fixes.

@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 0
P2 1
P3 1
Total 2

Reviewed 77 of 77 changed files.


This is an automated review by Codex GPT-5.6-Luna(max)


private static boolean containsMessage(final Throwable thrown, final String expectedMessage)
{
for (Throwable current = thrown; current != null; current = current.getCause()) {

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.

[P2] Expected-message matching is too permissive

The adapter searches all causes, whereas JUnit 4 ExpectedException matches the thrown exception's message. A wrapper with the expected text only in a nested cause can now make migrated tests pass despite a top-level message regression. Match only thrown.getMessage(), or preserve explicit cause-matcher semantics.

@Ignore
public class TopNQueryRunnerBenchmark extends AbstractBenchmark
@Disabled
public class TopNQueryRunnerBenchmark

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.

[P3] TopN benchmark loses measurement harness

Removing AbstractBenchmark and all BenchmarkOptions leaves this as a plain disabled JUnit 5 test. When manually run as a benchmark, testmMapped no longer receives JUnitBenchmarks warmup and measurement rounds. Retain the harness/options or migrate to an equivalent runner.

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.

JUnit4 to JUnit5 migration

3 participants