This is an automated email from the ASF dual-hosted git repository.
gyfora pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-kubernetes-operator.git
The following commit(s) were added to refs/heads/main by this push:
new bd4bd35e3 [FLINK-39853][test] Upgrade Testcontainers to 2.0.5 and
remove JUnit 4 dependency
bd4bd35e3 is described below
commit bd4bd35e36330fdcdea6185a6bfb25c6d2db0e9a
Author: Purushottam Sinha <[email protected]>
AuthorDate: Mon Jun 22 13:52:58 2026 +0530
[FLINK-39853][test] Upgrade Testcontainers to 2.0.5 and remove JUnit 4
dependency
Testcontainers 2.x removed its JUnit 4 coupling (GenericContainer no longer
implements org.junit.rules.TestRule and testcontainers-core has zero junit
references), so JUnit 4 is no longer required on the test classpath. This
drops the explicit junit:junit dependency that was only needed for
Testcontainers 1.x.
The junit:junit exclusion on flink-test-utils-junit is kept (now redundant)
as a guard so JUnit 4 cannot silently return through that dependency; the
junit-vintage-engine exclusion is also kept since Flink's test utils still
pull it in transitively and all tests run on JUnit 5.
Testcontainers 2.0 breaking changes handled:
- Module artifacts renamed: org.testcontainers:postgresql ->
testcontainers-postgresql, org.testcontainers:mysql ->
testcontainers-mysql.
- Container classes relocated to per-module packages
(org.testcontainers.containers.{MySQL,PostgreSQL}Container ->
org.testcontainers.{mysql,postgresql}.*) and are no longer self-typed
generics, so the diamond on field types and construction is removed.
---
flink-autoscaler-plugin-jdbc/pom.xml | 20 +++-----------------
.../testutils/databases/mysql/MySQLExtension.java | 6 +++---
.../databases/postgres/PostgreSQLExtension.java | 6 +++---
3 files changed, 9 insertions(+), 23 deletions(-)
diff --git a/flink-autoscaler-plugin-jdbc/pom.xml
b/flink-autoscaler-plugin-jdbc/pom.xml
index 5e2e276b6..4bee527cc 100644
--- a/flink-autoscaler-plugin-jdbc/pom.xml
+++ b/flink-autoscaler-plugin-jdbc/pom.xml
@@ -32,7 +32,7 @@ under the License.
<packaging>jar</packaging>
<properties>
- <testcontainers.version>1.18.2</testcontainers.version>
+ <testcontainers.version>2.0.5</testcontainers.version>
<postgres.version>42.5.6</postgres.version>
<mysql.version>8.4.0</mysql.version>
</properties>
@@ -117,20 +117,6 @@ under the License.
</exclusions>
</dependency>
- <!--
- Testcontainers 1.x container types implement
org.junit.rules.TestRule, so JUnit 4
- must stay on the test compile classpath even though all tests use
JUnit 5. The unused
- junit-vintage-engine is excluded above; only the junit:junit core
jar is pulled in here.
- TODO: remove this once Testcontainers is upgraded to a version
without the JUnit 4
- TestRule coupling (tracked in a follow-up JIRA).
- -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
- <scope>test</scope>
- </dependency>
-
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
@@ -155,7 +141,7 @@ under the License.
<dependency>
<groupId>org.testcontainers</groupId>
- <artifactId>postgresql</artifactId>
+ <artifactId>testcontainers-postgresql</artifactId>
<scope>test</scope>
</dependency>
@@ -169,7 +155,7 @@ under the License.
<dependency>
<groupId>org.testcontainers</groupId>
- <artifactId>mysql</artifactId>
+ <artifactId>testcontainers-mysql</artifactId>
<scope>test</scope>
</dependency>
diff --git
a/flink-autoscaler-plugin-jdbc/src/test/java/org/apache/flink/autoscaler/jdbc/testutils/databases/mysql/MySQLExtension.java
b/flink-autoscaler-plugin-jdbc/src/test/java/org/apache/flink/autoscaler/jdbc/testutils/databases/mysql/MySQLExtension.java
index 2dfb1acb0..f2f4591f1 100644
---
a/flink-autoscaler-plugin-jdbc/src/test/java/org/apache/flink/autoscaler/jdbc/testutils/databases/mysql/MySQLExtension.java
+++
b/flink-autoscaler-plugin-jdbc/src/test/java/org/apache/flink/autoscaler/jdbc/testutils/databases/mysql/MySQLExtension.java
@@ -23,7 +23,7 @@ import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
-import org.testcontainers.containers.MySQLContainer;
+import org.testcontainers.mysql.MySQLContainer;
import java.util.List;
@@ -37,11 +37,11 @@ class MySQLExtension implements BeforeAllCallback,
AfterAllCallback, AfterEachCa
private static final List<String> TABLES =
List.of("t_flink_autoscaler_state_store",
"t_flink_autoscaler_event_handler");
- private final MySQLContainer<?> container;
+ private final MySQLContainer container;
public MySQLExtension(String mysqlVersion) {
this.container =
- new MySQLContainer<>(String.format("mysql:%s", mysqlVersion))
+ new MySQLContainer(String.format("mysql:%s", mysqlVersion))
.withCommand("--character-set-server=utf8")
.withDatabaseName(DATABASE_NAME)
.withUsername(USER_NAME)
diff --git
a/flink-autoscaler-plugin-jdbc/src/test/java/org/apache/flink/autoscaler/jdbc/testutils/databases/postgres/PostgreSQLExtension.java
b/flink-autoscaler-plugin-jdbc/src/test/java/org/apache/flink/autoscaler/jdbc/testutils/databases/postgres/PostgreSQLExtension.java
index a54657fc5..946990311 100644
---
a/flink-autoscaler-plugin-jdbc/src/test/java/org/apache/flink/autoscaler/jdbc/testutils/databases/postgres/PostgreSQLExtension.java
+++
b/flink-autoscaler-plugin-jdbc/src/test/java/org/apache/flink/autoscaler/jdbc/testutils/databases/postgres/PostgreSQLExtension.java
@@ -23,7 +23,7 @@ import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
-import org.testcontainers.containers.PostgreSQLContainer;
+import org.testcontainers.postgresql.PostgreSQLContainer;
import java.util.List;
@@ -37,11 +37,11 @@ class PostgreSQLExtension implements BeforeAllCallback,
AfterAllCallback, AfterE
private static final List<String> TABLES =
List.of("t_flink_autoscaler_state_store",
"t_flink_autoscaler_event_handler");
- private final PostgreSQLContainer<?> container;
+ private final PostgreSQLContainer container;
public PostgreSQLExtension(String postgresqlVersion) {
this.container =
- new PostgreSQLContainer<>(String.format("postgres:%s",
postgresqlVersion))
+ new PostgreSQLContainer(String.format("postgres:%s",
postgresqlVersion))
.withDatabaseName(DATABASE_NAME)
.withUsername(USER_NAME)
.withPassword(PASSWORD)