This is an automated email from the ASF dual-hosted git repository.
MartijnVisser pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-connector-jdbc.git
The following commit(s) were added to refs/heads/main by this push:
new fe8c4e09 [FLINK-40777][tests] Run the XA connection tests against
PostgreSQL (#250)
fe8c4e09 is described below
commit fe8c4e09b646092ab22579e40f1b3349b4fac610
Author: Martijn Visser <[email protected]>
AuthorDate: Fri Sep 25 11:49:15 2026 +0200
[FLINK-40777][tests] Run the XA connection tests against PostgreSQL (#250)
- SimpleXaConnectionProviderTest and TransactionIdConnectionTest are
abstract over DatabaseTest, with Derby and PostgreSQL subclasses
- Both roll back leftover prepared transactions after each test and
close the assertBooks connection
- SimpleXaConnectionProviderPrepareTest covers XA_RDONLY from prepare
without a database and replaces both testEmptyTransaction cases
- New testRecoverFindsTransactionPreparedOnAnotherConnection
- PostgresDatabase no longer keeps a stale URL after a container
restart
Generated-by: Claude Code (Claude Opus 5.5)
---
.../xa/SimpleXaConnectionProviderPrepareTest.java | 161 +++++++++++++++++++++
.../xa/SimpleXaConnectionProviderTest.java | 67 ++++++---
.../xa/TransactionIdConnectionTest.java | 53 +++----
.../xa/DerbySimpleXaConnectionProviderTest.java | 25 ++++
.../xa/DerbyTransactionIdConnectionTest.java | 25 ++++
.../xa/PostgresSimpleXaConnectionProviderTest.java | 25 ++++
.../xa/PostgresTransactionIdConnectionTest.java | 25 ++++
.../jdbc/postgres/testutils/PostgresDatabase.java | 8 +-
8 files changed, 329 insertions(+), 60 deletions(-)
diff --git
a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/datasource/connections/xa/SimpleXaConnectionProviderPrepareTest.java
b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/datasource/connections/xa/SimpleXaConnectionProviderPrepareTest.java
new file mode 100644
index 00000000..6c56aa4f
--- /dev/null
+++
b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/datasource/connections/xa/SimpleXaConnectionProviderPrepareTest.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.connector.jdbc.datasource.connections.xa;
+
+import
org.apache.flink.connector.jdbc.datasource.transactions.xa.domain.TransactionId;
+import
org.apache.flink.connector.jdbc.datasource.transactions.xa.exceptions.EmptyTransactionXaException;
+
+import org.junit.jupiter.api.Test;
+
+import javax.sql.ConnectionEventListener;
+import javax.sql.StatementEventListener;
+import javax.sql.XAConnection;
+import javax.sql.XADataSource;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.logging.Logger;
+
+import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+
+/** Tests how {@link SimpleXaConnectionProvider} handles the result of {@code
prepare}. */
+class SimpleXaConnectionProviderPrepareTest {
+
+ @Test
+ void testReadOnlyPrepareIsAnEmptyTransaction() throws SQLException {
+ Xid xid = TransactionId.empty().withBranch(1L);
+ try (SimpleXaConnectionProvider xa =
+ SimpleXaConnectionProvider.from(
+ new PrepareResultDataSource(XAResource.XA_RDONLY))) {
+ xa.open();
+ xa.start(xid);
+ assertThatExceptionOfType(EmptyTransactionXaException.class)
+ .isThrownBy(() -> xa.endAndPrepare(xid))
+ .withMessage("end response XA_RDONLY, xid: " + xid);
+ }
+ }
+
+ /** Hands out a plain H2 connection and an {@link XAResource} with a fixed
prepare result. */
+ private static class PrepareResultDataSource implements XADataSource,
XAConnection, XAResource {
+ private final int prepareResult;
+
+ PrepareResultDataSource(int prepareResult) {
+ this.prepareResult = prepareResult;
+ }
+
+ @Override
+ public XAConnection getXAConnection() {
+ return this;
+ }
+
+ @Override
+ public XAConnection getXAConnection(String user, String password) {
+ return this;
+ }
+
+ @Override
+ public XAResource getXAResource() {
+ return this;
+ }
+
+ @Override
+ public Connection getConnection() throws SQLException {
+ return DriverManager.getConnection("jdbc:h2:mem:");
+ }
+
+ @Override
+ public void close() {}
+
+ @Override
+ public int prepare(Xid xid) {
+ return prepareResult;
+ }
+
+ @Override
+ public void start(Xid xid, int flags) {}
+
+ @Override
+ public void end(Xid xid, int flags) {}
+
+ @Override
+ public void commit(Xid xid, boolean onePhase) {}
+
+ @Override
+ public void rollback(Xid xid) {}
+
+ @Override
+ public void forget(Xid xid) {}
+
+ @Override
+ public Xid[] recover(int flag) {
+ return new Xid[0];
+ }
+
+ @Override
+ public boolean isSameRM(XAResource other) {
+ return other == this;
+ }
+
+ @Override
+ public int getTransactionTimeout() {
+ return 0;
+ }
+
+ @Override
+ public boolean setTransactionTimeout(int seconds) {
+ return false;
+ }
+
+ @Override
+ public void addConnectionEventListener(ConnectionEventListener
listener) {}
+
+ @Override
+ public void removeConnectionEventListener(ConnectionEventListener
listener) {}
+
+ @Override
+ public void addStatementEventListener(StatementEventListener listener)
{}
+
+ @Override
+ public void removeStatementEventListener(StatementEventListener
listener) {}
+
+ @Override
+ public PrintWriter getLogWriter() {
+ return null;
+ }
+
+ @Override
+ public void setLogWriter(PrintWriter out) {}
+
+ @Override
+ public void setLoginTimeout(int seconds) {}
+
+ @Override
+ public int getLoginTimeout() {
+ return 0;
+ }
+
+ @Override
+ public Logger getParentLogger() {
+ return Logger.getGlobal();
+ }
+ }
+}
diff --git
a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/datasource/connections/xa/SimpleXaConnectionProviderTest.java
b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/datasource/connections/xa/SimpleXaConnectionProviderTest.java
index 05825056..ea0468e3 100644
---
a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/datasource/connections/xa/SimpleXaConnectionProviderTest.java
+++
b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/datasource/connections/xa/SimpleXaConnectionProviderTest.java
@@ -18,11 +18,11 @@
package org.apache.flink.connector.jdbc.datasource.connections.xa;
import
org.apache.flink.connector.jdbc.datasource.transactions.xa.domain.TransactionId;
-import
org.apache.flink.connector.jdbc.datasource.transactions.xa.exceptions.EmptyTransactionXaException;
-import org.apache.flink.connector.jdbc.derby.DerbyTestBase;
+import org.apache.flink.connector.jdbc.testutils.DatabaseTest;
import org.apache.flink.connector.jdbc.testutils.TableManaged;
import org.apache.flink.connector.jdbc.testutils.tables.templates.BooksTable;
+import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import javax.transaction.xa.Xid;
@@ -36,9 +36,9 @@ import java.util.Collections;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
-class SimpleXaConnectionProviderTest implements DerbyTestBase {
+/** Tests for {@link SimpleXaConnectionProvider} against a database with
two-phase commit. */
+public abstract class SimpleXaConnectionProviderTest implements DatabaseTest {
private static final BooksTable TEST_TABLE = new BooksTable("XaTable");
private static final TransactionId TRANSACTION_BASE =
TransactionId.empty();
@@ -49,10 +49,23 @@ class SimpleXaConnectionProviderTest implements
DerbyTestBase {
}
public void assertBooks(List<BooksTable.BookEntry> expected) throws
SQLException {
- List<BooksTable.BookEntry> current =
- TEST_TABLE.selectAllTable(getMetadata().getConnection());
- assertThat(current.size()).isEqualTo(expected.size());
- assertThat(current).isEqualTo(expected);
+ try (Connection connection = getMetadata().getConnection()) {
+ List<BooksTable.BookEntry> current =
TEST_TABLE.selectAllTable(connection);
+ assertThat(current.size()).isEqualTo(expected.size());
+ assertThat(current).isEqualTo(expected);
+ }
+ }
+
+ /** A failed test can leave a prepared transaction behind, which holds its
locks. */
+ @AfterEach
+ void rollbackPreparedTransactions() throws SQLException {
+ try (SimpleXaConnectionProvider xa =
+
SimpleXaConnectionProvider.from(getMetadata().buildXaDataSource())) {
+ xa.open();
+ for (Xid xid : xa.recover()) {
+ xa.rollback(xid);
+ }
+ }
}
@Test
@@ -124,23 +137,29 @@ class SimpleXaConnectionProviderTest implements
DerbyTestBase {
}
@Test
- void testEmptyTransaction() throws SQLException {
+ void testRecoverFindsTransactionPreparedOnAnotherConnection() throws
SQLException {
Xid xid = TRANSACTION_BASE.withBranch(System.currentTimeMillis());
- assertThatExceptionOfType(EmptyTransactionXaException.class)
- .isThrownBy(
- () -> {
- try (SimpleXaConnectionProvider xa =
- SimpleXaConnectionProvider.from(
-
getMetadata().buildXaDataSource())) {
- xa.open();
- // Start transaction
- xa.start(xid);
- // Prepare the transaction
- xa.endAndPrepare(xid);
- // This should fail
- }
- })
- .withMessage("end response XA_RDONLY, xid: " + xid.toString());
+ try (SimpleXaConnectionProvider xa =
+
SimpleXaConnectionProvider.from(getMetadata().buildXaDataSource())) {
+ xa.open();
+ xa.start(xid);
+ try (PreparedStatement ps =
+
xa.getConnection().prepareStatement(TEST_TABLE.getInsertIntoQuery())) {
+ TEST_TABLE
+ .getStatementBuilder()
+ .accept(ps, new BooksTable.BookEntry(1, "title1",
"author1", 100D, 10));
+ ps.execute();
+ }
+ xa.endAndPrepare(xid);
+ }
+
+ try (SimpleXaConnectionProvider xa =
+
SimpleXaConnectionProvider.from(getMetadata().buildXaDataSource())) {
+ xa.open();
+ assertThat(xa.recover()).contains(xid);
+ xa.rollback(xid);
+ assertThat(xa.recover()).doesNotContain(xid);
+ }
assertBooks(new ArrayList<>());
}
diff --git
a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/datasource/connections/xa/TransactionIdConnectionTest.java
b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/datasource/connections/xa/TransactionIdConnectionTest.java
index 317147fb..3595545b 100644
---
a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/datasource/connections/xa/TransactionIdConnectionTest.java
+++
b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/datasource/connections/xa/TransactionIdConnectionTest.java
@@ -19,13 +19,15 @@ package
org.apache.flink.connector.jdbc.datasource.connections.xa;
import org.apache.flink.api.common.JobID;
import
org.apache.flink.connector.jdbc.datasource.transactions.xa.domain.TransactionId;
-import
org.apache.flink.connector.jdbc.datasource.transactions.xa.exceptions.EmptyTransactionXaException;
-import org.apache.flink.connector.jdbc.derby.DerbyTestBase;
+import org.apache.flink.connector.jdbc.testutils.DatabaseTest;
import org.apache.flink.connector.jdbc.testutils.TableManaged;
import org.apache.flink.connector.jdbc.testutils.tables.templates.BooksTable;
+import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
+import javax.transaction.xa.Xid;
+
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -36,9 +38,9 @@ import java.util.Collections;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
-class TransactionIdConnectionTest implements DerbyTestBase {
+/** Tests for {@link SimpleXaConnectionProvider} with the {@link
TransactionId}s a job creates. */
+public abstract class TransactionIdConnectionTest implements DatabaseTest {
private static final BooksTable TEST_TABLE = new BooksTable("XaTable");
private static final byte[] JOB_ID =
@@ -50,10 +52,23 @@ class TransactionIdConnectionTest implements DerbyTestBase {
}
public void assertBooks(List<BooksTable.BookEntry> expected) throws
SQLException {
- List<BooksTable.BookEntry> current =
- TEST_TABLE.selectAllTable(getMetadata().getConnection());
- assertThat(current.size()).isEqualTo(expected.size());
- assertThat(current).isEqualTo(expected);
+ try (Connection connection = getMetadata().getConnection()) {
+ List<BooksTable.BookEntry> current =
TEST_TABLE.selectAllTable(connection);
+ assertThat(current.size()).isEqualTo(expected.size());
+ assertThat(current).isEqualTo(expected);
+ }
+ }
+
+ /** A failed test can leave a prepared transaction behind, which holds its
locks. */
+ @AfterEach
+ void rollbackPreparedTransactions() throws SQLException {
+ try (SimpleXaConnectionProvider xa =
+
SimpleXaConnectionProvider.from(getMetadata().buildXaDataSource())) {
+ xa.open();
+ for (Xid xid : xa.recover()) {
+ xa.rollback(xid);
+ }
+ }
}
@Test
@@ -124,28 +139,6 @@ class TransactionIdConnectionTest implements DerbyTestBase
{
assertBooks(expected);
}
- @Test
- void testEmptyTransaction() throws SQLException {
- TransactionId xid = TransactionId.create(JOB_ID, 1,
1).withBranch(123L);
- assertThatExceptionOfType(EmptyTransactionXaException.class)
- .isThrownBy(
- () -> {
- try (SimpleXaConnectionProvider xa =
- SimpleXaConnectionProvider.from(
-
getMetadata().buildXaDataSource())) {
- xa.open();
- // Start transaction
- xa.start(xid);
- // Prepare the transaction
- xa.endAndPrepare(xid);
- // This should fail
- }
- })
- .withMessage("end response XA_RDONLY, xid: " + xid.toString());
-
- assertBooks(new ArrayList<>());
- }
-
@Test
void testEmptyFailAndRollbackTransaction() throws SQLException {
diff --git
a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/derby/datasource/connections/xa/DerbySimpleXaConnectionProviderTest.java
b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/derby/datasource/connections/xa/DerbySimpleXaConnectionProviderTest.java
new file mode 100644
index 00000000..625464ad
--- /dev/null
+++
b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/derby/datasource/connections/xa/DerbySimpleXaConnectionProviderTest.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.connector.jdbc.derby.datasource.connections.xa;
+
+import
org.apache.flink.connector.jdbc.datasource.connections.xa.SimpleXaConnectionProviderTest;
+import org.apache.flink.connector.jdbc.derby.DerbyTestBase;
+
+/** The {@link SimpleXaConnectionProviderTest} for Derby. */
+class DerbySimpleXaConnectionProviderTest extends
SimpleXaConnectionProviderTest
+ implements DerbyTestBase {}
diff --git
a/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/derby/datasource/connections/xa/DerbyTransactionIdConnectionTest.java
b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/derby/datasource/connections/xa/DerbyTransactionIdConnectionTest.java
new file mode 100644
index 00000000..52124dd1
--- /dev/null
+++
b/flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/derby/datasource/connections/xa/DerbyTransactionIdConnectionTest.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.connector.jdbc.derby.datasource.connections.xa;
+
+import
org.apache.flink.connector.jdbc.datasource.connections.xa.TransactionIdConnectionTest;
+import org.apache.flink.connector.jdbc.derby.DerbyTestBase;
+
+/** The {@link TransactionIdConnectionTest} for Derby. */
+class DerbyTransactionIdConnectionTest extends TransactionIdConnectionTest
+ implements DerbyTestBase {}
diff --git
a/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/datasource/connections/xa/PostgresSimpleXaConnectionProviderTest.java
b/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/datasource/connections/xa/PostgresSimpleXaConnectionProviderTest.java
new file mode 100644
index 00000000..9e33d2c4
--- /dev/null
+++
b/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/datasource/connections/xa/PostgresSimpleXaConnectionProviderTest.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.connector.jdbc.postgres.datasource.connections.xa;
+
+import
org.apache.flink.connector.jdbc.datasource.connections.xa.SimpleXaConnectionProviderTest;
+import org.apache.flink.connector.jdbc.postgres.PostgresTestBase;
+
+/** The {@link SimpleXaConnectionProviderTest} for PostgreSQL. */
+class PostgresSimpleXaConnectionProviderTest extends
SimpleXaConnectionProviderTest
+ implements PostgresTestBase {}
diff --git
a/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/datasource/connections/xa/PostgresTransactionIdConnectionTest.java
b/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/datasource/connections/xa/PostgresTransactionIdConnectionTest.java
new file mode 100644
index 00000000..32a25dd9
--- /dev/null
+++
b/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/datasource/connections/xa/PostgresTransactionIdConnectionTest.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.connector.jdbc.postgres.datasource.connections.xa;
+
+import
org.apache.flink.connector.jdbc.datasource.connections.xa.TransactionIdConnectionTest;
+import org.apache.flink.connector.jdbc.postgres.PostgresTestBase;
+
+/** The {@link TransactionIdConnectionTest} for PostgreSQL. */
+class PostgresTransactionIdConnectionTest extends TransactionIdConnectionTest
+ implements PostgresTestBase {}
diff --git
a/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/testutils/PostgresDatabase.java
b/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/testutils/PostgresDatabase.java
index 0b871ec4..fbe2fb3a 100644
---
a/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/testutils/PostgresDatabase.java
+++
b/flink-connector-jdbc-postgres/src/test/java/org/apache/flink/connector/jdbc/postgres/testutils/PostgresDatabase.java
@@ -34,16 +34,12 @@ public class PostgresDatabase extends DatabaseExtension
implements PostgresImage
private static final PostgreSQLContainer<?> CONTAINER =
new
PostgresXaContainer(POSTGRES_16).withMaxConnections(10).withMaxTransactions(50);
- private static PostgresMetadata metadata;
-
public static PostgresMetadata getMetadata() {
if (!CONTAINER.isRunning()) {
throw new FlinkRuntimeException("Container is stopped.");
}
- if (metadata == null) {
- metadata = new PostgresMetadata(CONTAINER, true);
- }
- return metadata;
+ // Not cached: a reused fork restarts the container for each test
class, on a new port.
+ return new PostgresMetadata(CONTAINER, true);
}
protected DatabaseMetadata getMetadataDB() {