From 43ab6c5827301572e48b7c6b4f609d8933ce017b Mon Sep 17 00:00:00 2001 From: Lixi20 Date: Fri, 4 Sep 2026 11:34:08 +0800 Subject: [PATCH] =?UTF-8?q?test:=20Testcontainers=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E9=95=9C=E5=83=8F=E5=8D=87=E7=BA=A7=E4=B8=BA=20postgr?= =?UTF-8?q?es:18=EF=BC=88ADR-008=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 验收:JAVA_HOME=jdk17 ./mvnw clean test 全量 37 测试 0 失败,Flyway V1 于 PostgreSQL 18.6 执行无兼容问题 --- .../com/patbond/patbond/user/TestcontainersConfiguration.java | 4 ++-- .../user/persistence/UserPersistenceIntegrationTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/patbond-user/src/test/java/com/patbond/patbond/user/TestcontainersConfiguration.java b/patbond-user/src/test/java/com/patbond/patbond/user/TestcontainersConfiguration.java index b732ab9..f955daf 100644 --- a/patbond-user/src/test/java/com/patbond/patbond/user/TestcontainersConfiguration.java +++ b/patbond-user/src/test/java/com/patbond/patbond/user/TestcontainersConfiguration.java @@ -7,7 +7,7 @@ import org.testcontainers.containers.PostgreSQLContainer; import org.testcontainers.utility.DockerImageName; /** - * Shared Testcontainers setup: a disposable postgres:16 (the production + * Shared Testcontainers setup: a disposable postgres:18 (the production * target version) wired into the Spring context via @ServiceConnection. * Flyway runs the real migrations against it on context startup, so every * @SpringBootTest in this module exercises the V1 baseline on a clean @@ -19,6 +19,6 @@ public class TestcontainersConfiguration { @Bean @ServiceConnection PostgreSQLContainer postgresContainer() { - return new PostgreSQLContainer<>(DockerImageName.parse("postgres:16")); + return new PostgreSQLContainer<>(DockerImageName.parse("postgres:18")); } } diff --git a/patbond-user/src/test/java/com/patbond/patbond/user/persistence/UserPersistenceIntegrationTest.java b/patbond-user/src/test/java/com/patbond/patbond/user/persistence/UserPersistenceIntegrationTest.java index 69aa4b5..ebd1ebf 100644 --- a/patbond-user/src/test/java/com/patbond/patbond/user/persistence/UserPersistenceIntegrationTest.java +++ b/patbond-user/src/test/java/com/patbond/patbond/user/persistence/UserPersistenceIntegrationTest.java @@ -24,7 +24,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; /** * Verifies the Flyway V1 baseline and the real persistence semantics against - * a clean postgres:16 container: migrations apply, constraints hold, and a + * a clean postgres:18 container: migrations apply, constraints hold, and a * registered user is durably stored in PostgreSQL (readable over a fresh raw * JDBC connection, i.e. independent of any application-process memory — the * restart-survival semantics that killed the old ConcurrentHashMap storage).