Skip to content

Flink: Exclude Vintage and clean up test deps - #17770

Open
subhramit wants to merge 5 commits into
apache:mainfrom
subhramit:flink-exclude-junit4-transitive-deps
Open

Flink: Exclude Vintage and clean up test deps#17770
subhramit wants to merge 5 commits into
apache:mainfrom
subhramit:flink-exclude-junit4-transitive-deps

Conversation

@subhramit

@subhramit subhramit commented Aug 22, 2026

Copy link
Copy Markdown

Partially addresses #12937.

Exclude junit and org.junit.vintage from the connector.test.utils and test.utils test dependencies in all three Flink modules (v1.20, v2.0, v2.1), and remove the now-redundant explicit flink-test-utils-junit dependency and its libs.versions.toml aliases.

Keep junit:junit as an explicit runtime-only dependency for Flink tests and integration tests in those modules as a temporary workaround for Flink's own transitive test infrastructure.

Full removal of JUnit 4 from the Flink test runtime remains blocked upstream by FLINK-25325.
Although the Iceberg Flink tests in this branch already use JUnit 5 extensions (for example, TestIcebergSourceFailover uses MiniClusterExtension, not MiniClusterWithClientResource), Flink's transitive flink-test-utils-junit implementation still requires JUnit 4 classes at runtime.

Testing

Verified via repo search that no Iceberg Flink test class under flink/ references MiniClusterWithClientResource, org.junit.rules, @Rule, or ExternalResource. Also ran:

./gradlew :iceberg-flink:iceberg-flink-2.0:dependencies --configuration testRuntimeClasspath | grep -i junit

(see output below in Details)
to confirm junit-vintage-engine and org.junit.vintage no longer resolve. junit:junit:4.13.2 still resolves intentionally as an explicit runtime-only workaround.

Details
+--- org.junit.jupiter:junit-jupiter:5.14.4
|    +--- org.junit:junit-bom:5.14.4
|    |    +--- org.junit.jupiter:junit-jupiter:5.14.4 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-api:5.14.4 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-engine:5.14.4 (c)
|    |    +--- org.junit.jupiter:junit-jupiter-params:5.14.4 (c)
|    |    +--- org.junit.platform:junit-platform-engine:1.14.4 (c)
|    |    +--- org.junit.platform:junit-platform-launcher:1.14.4 (c)
|    |    \--- org.junit.platform:junit-platform-commons:1.14.4 (c)
|    +--- org.junit.jupiter:junit-jupiter-api:5.14.4
|    |    +--- org.junit:junit-bom:5.14.4 (*)
|    |    \--- org.junit.platform:junit-platform-commons:1.14.4
|    |         \--- org.junit:junit-bom:5.14.4 (*)
|    +--- org.junit.jupiter:junit-jupiter-params:5.14.4
|    |    +--- org.junit:junit-bom:5.14.4 (*)
|    |    \--- org.junit.jupiter:junit-jupiter-api:5.14.4 (*)
|    \--- org.junit.jupiter:junit-jupiter-engine:5.14.4
|         +--- org.junit:junit-bom:5.14.4 (*)
|         +--- org.junit.platform:junit-platform-engine:1.14.4
|         |    +--- org.junit:junit-bom:5.14.4 (*)
|         |    \--- org.junit.platform:junit-platform-commons:1.14.4 (*)
|         \--- org.junit.jupiter:junit-jupiter-api:5.14.4 (*)
+--- org.junit.jupiter:junit-jupiter-engine:5.14.4 (*)
+--- org.junit.platform:junit-platform-launcher:1.14.4
|    +--- org.junit:junit-bom:5.14.4 (*)
|    \--- org.junit.platform:junit-platform-engine:1.14.4 (*)
|    |    +--- org.apache.flink:flink-test-utils-junit:2.0.0
|    |    |    +--- org.junit.jupiter:junit-jupiter:5.11.4 -> 5.14.4 (*)
|    |    +--- org.junit.jupiter:junit-jupiter:5.11.4 -> 5.14.4 (*)
|    |    |    \--- org.junit.jupiter:junit-jupiter-api:5.6.2 -> 5.14.4 (*)
|    +--- org.apache.flink:flink-test-utils-junit:2.0.0 (*)
|    +--- org.junit.jupiter:junit-jupiter:5.11.4 -> 5.14.4 (*)
\--- junit:junit:4.13.2

Also ran some focused tests:

./gradlew -DflinkVersions=1.20 :iceberg-flink:iceberg-flink-1.20:test --tests org.apache.iceberg.flink.TestFlinkConfParser
./gradlew -DflinkVersions=2.0 :iceberg-flink:iceberg-flink-2.0:test --tests org.apache.iceberg.flink.TestFlinkConfParser
./gradlew -DflinkVersions=2.1 :iceberg-flink:iceberg-flink-2.1:test --tests org.apache.iceberg.flink.TestFlinkConfParser
./gradlew spotlessCheck

Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
@subhramit subhramit changed the title Flink exclude junit4 transitive deps Flink: Exclude Vintage and clean up test deps Aug 22, 2026
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>

@uros-b uros-b left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just one ordering nit

Comment thread gradle/libs.versions.toml Outdated
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" }
junit-pioneer = { module = "org.junit-pioneer:junit-pioneer", version.ref = "junit-pioneer" }
junit-v4 = { module = "junit:junit", version.ref = "junit4" }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

junit-v4 is inserted between junit-pioneer (line 213) and junit-platform-launcher (line 214), but the junit-* library block is strictly alphabetically ordered (junit-jupiter → junit-jupiter-engine → junit-pioneer → junit-platform-launcher → junit-suite-api → junit-suite-engine). Since v > s, junit-v4 should be placed after junit-suite-engine. A one-line reorder in the TOML is all that is needed.

@subhramit subhramit Aug 23, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done, thanks!

Signed-off-by: subhramit <subhramit.bb@live.in>
@subhramit

Copy link
Copy Markdown
Author

Also cc'ing @mxm @nastra @huaxingao

@subhramit
subhramit requested a review from uros-b August 24, 2026 20:32
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.

2 participants