fix: use asCompatibleSubstituteFor for TimescaleDB Testcontainer image

This commit is contained in:
hsiegeln
2026-03-16 19:06:54 +01:00
parent 41e2038190
commit 589da1b6d6

View File

@@ -8,14 +8,19 @@ import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.containers.PostgreSQLContainer; import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers; import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Testcontainers @Testcontainers
public abstract class AbstractPostgresIT { public abstract class AbstractPostgresIT {
private static final DockerImageName TIMESCALEDB_IMAGE =
DockerImageName.parse("timescale/timescaledb:latest-pg16")
.asCompatibleSubstituteFor("postgres");
@Container @Container
static final PostgreSQLContainer<?> postgres = static final PostgreSQLContainer<?> postgres =
new PostgreSQLContainer<>("timescale/timescaledb:latest-pg16") new PostgreSQLContainer<>(TIMESCALEDB_IMAGE)
.withDatabaseName("cameleer3") .withDatabaseName("cameleer3")
.withUsername("cameleer") .withUsername("cameleer")
.withPassword("test"); .withPassword("test");