Purushottam Sinha created FLINK-39853:
-----------------------------------------
Summary: Upgrade Testcontainers to 2.0.5 and remove the JUnit 4
dependency from flink-autoscaler-plugin-jdbc
Key: FLINK-39853
URL: https://issues.apache.org/jira/browse/FLINK-39853
Project: Flink
Issue Type: Sub-task
Components: Kubernetes Operator
Reporter: Purushottam Sinha
After the JUnit 5 migration, flink-autoscaler-plugin-jdbc still carried JUnit 4
on its test classpath. This was unavoidable on Testcontainers 1.x:
GenericContainer implemented org.junit.rules.TestRule, so JUnit 4 was required
at compile time, and the module pinned the old Testcontainers 1.18.2 plus an
explicit junit:junit dependency purely to satisfy that coupling.
Testcontainers 2.0.0 (2025-10-14) removed JUnit 4 support — testcontainers-core
no longer references JUnit 4 and GenericContainer no longer implements
TestRule. Upgrading lets us remove JUnit 4 entirely.
Changes:
- Bump testcontainers.version 1.18.2 → 2.0.5 (via the testcontainers-bom
import).
- Remove the explicit junit:junit test dependency (only needed for
Testcontainers 1.x).
- Handle Testcontainers 2.0 breaking changes:
** Renamed module artifacts: org.testcontainers:postgresql →
testcontainers-postgresql, org.testcontainers:mysql → testcontainers-mysql.
** Relocated container classes:
org.testcontainers.containers.{MySQL,PostgreSQL}Container →
org.testcontainers.{mysql,postgresql}.*, which are no longer self-typed
generics (drop the <> on field types and construction).
- Keep the junit-vintage-engine exclusion on flink-test-utils-junit (Flink's
test utils still pull it in transitively), plus a junit:junit exclusion as a
guard so JUnit 4 cannot silently return.
Verification:
- Dependency tree shows no junit:junit and no junit-vintage-engine.
- flink-autoscaler-plugin-jdbc builds and all container integration tests pass
against Testcontainers 2.0.5: MySQL 5.6 / 5.7 / 8.0, PostgreSQL 15, Derby (113
tests, 0 failures).
Acceptance criteria:
- Module builds and tests pass with no junit:junit / org.junit.vintage on the
dependency tree
--
This message was sent by Atlassian Jira
(v8.20.10#820010)