From bfb837b22beca304dadd9b7cbe3f742c1523ce13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez=20Gonzales?= Date: Wed, 28 Feb 2024 17:42:40 -0500 Subject: [PATCH] Add pgvector/pgvector as a compatible image (#7898) (#8401) --- .../org/testcontainers/containers/PostgreSQLContainer.java | 6 ++++-- .../org/testcontainers/containers/CompatibleImageTest.java | 4 +--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java b/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java index bc276f4cc1b..27b3679b626 100644 --- a/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java +++ b/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java @@ -11,7 +11,7 @@ /** * Testcontainers implementation for PostgreSQL. *

- * Supported image: {@code postgres} + * Supported images: {@code postgres}, {@code pgvector/pgvector} *

* Exposed ports: 5432 */ @@ -25,6 +25,8 @@ public class PostgreSQLContainer> extends private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("postgres"); + private static final DockerImageName PGVECTOR_IMAGE_NAME = DockerImageName.parse("pgvector/pgvector"); + public static final Integer POSTGRESQL_PORT = 5432; static final String DEFAULT_USER = "test"; @@ -53,7 +55,7 @@ public PostgreSQLContainer(final String dockerImageName) { public PostgreSQLContainer(final DockerImageName dockerImageName) { super(dockerImageName); - dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME); + dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME, PGVECTOR_IMAGE_NAME); this.waitStrategy = new LogMessageWaitStrategy() diff --git a/modules/postgresql/src/test/java/org/testcontainers/containers/CompatibleImageTest.java b/modules/postgresql/src/test/java/org/testcontainers/containers/CompatibleImageTest.java index 2bb1c6c3d54..76b4a8c1bda 100644 --- a/modules/postgresql/src/test/java/org/testcontainers/containers/CompatibleImageTest.java +++ b/modules/postgresql/src/test/java/org/testcontainers/containers/CompatibleImageTest.java @@ -15,9 +15,7 @@ public class CompatibleImageTest extends AbstractContainerDatabaseTest { public void pgvector() throws SQLException { try ( // pgvectorContainer { - PostgreSQLContainer pgvector = new PostgreSQLContainer<>( - DockerImageName.parse("pgvector/pgvector:pg16").asCompatibleSubstituteFor("postgres") - ) + PostgreSQLContainer pgvector = new PostgreSQLContainer<>("pgvector/pgvector:pg16") // } ) { pgvector.start();