test: Testcontainers 数据库镜像升级为 postgres:18(ADR-008)

- 验收:JAVA_HOME=jdk17 ./mvnw clean test 全量 37 测试 0 失败,Flyway V1 于 PostgreSQL 18.6 执行无兼容问题
This commit is contained in:
2026-09-04 11:34:08 +08:00
parent bd20adc700
commit 43ab6c5827
2 changed files with 3 additions and 3 deletions
@@ -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"));
}
}
@@ -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).