From 88bc5e2307fe8b14d42d6e2a56584e0490959afa Mon Sep 17 00:00:00 2001 From: Miquel Simon Date: Fri, 25 Nov 2022 10:46:31 +0100 Subject: [PATCH] Use different Postgres image in Testcontainers. Upgraded Testcontainers dependency to 1.17.5. --- pom.xml | 2 +- .../testsuite/arquillian/PostgresContainerTestEnricher.java | 3 ++- .../org/keycloak/testsuite/model/parameters/JpaMapStorage.java | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 99be1dc603..b72c9fbf66 100644 --- a/pom.xml +++ b/pom.xml @@ -167,7 +167,7 @@ https://issues.redhat.com/browse/KEYCLOAK-17585?focusedCommentId=16002705&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16002705 --> 2.3 - 1.16.3 + 1.17.5 1.3.5 diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/PostgresContainerTestEnricher.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/PostgresContainerTestEnricher.java index 015d26c79b..1fdceacbae 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/PostgresContainerTestEnricher.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/PostgresContainerTestEnricher.java @@ -20,12 +20,13 @@ import org.jboss.arquillian.container.spi.event.StartSuiteContainers; import org.jboss.arquillian.core.api.annotation.Observes; import org.jboss.arquillian.test.spi.event.suite.AfterSuite; import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.utility.DockerImageName; public class PostgresContainerTestEnricher { private static final Boolean START_CONTAINER = Boolean.valueOf(System.getProperty("postgres.start-container", "false")); private static final String POSTGRES_DOCKER_IMAGE_NAME = System.getProperty("keycloak.map.storage.postgres.docker.image", "postgres:alpine"); - private static final PostgreSQLContainer POSTGRES_CONTAINER = new PostgreSQLContainer(POSTGRES_DOCKER_IMAGE_NAME); + private static final PostgreSQLContainer POSTGRES_CONTAINER = new PostgreSQLContainer(DockerImageName.parse(POSTGRES_DOCKER_IMAGE_NAME).asCompatibleSubstituteFor("postgres")); private static final String POSTGRES_DB_USER = System.getProperty("keycloak.map.storage.connectionsJpa.user", "keycloak"); private static final String POSTGRES_DB_PASSWORD = System.getProperty("keycloak.map.storage.connectionsJpa.password", "pass"); diff --git a/testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/JpaMapStorage.java b/testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/JpaMapStorage.java index f68fb2d833..43c87c07c1 100644 --- a/testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/JpaMapStorage.java +++ b/testsuite/model/src/test/java/org/keycloak/testsuite/model/parameters/JpaMapStorage.java @@ -52,6 +52,7 @@ import org.keycloak.sessions.AuthenticationSessionSpi; import org.keycloak.testsuite.model.Config; import org.keycloak.testsuite.model.KeycloakModelParameters; import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.utility.DockerImageName; public class JpaMapStorage extends KeycloakModelParameters { @@ -59,7 +60,7 @@ public class JpaMapStorage extends KeycloakModelParameters { private static final Boolean START_CONTAINER = Boolean.valueOf(System.getProperty("postgres.start-container", "true")); private static final String POSTGRES_DOCKER_IMAGE_NAME = System.getProperty("keycloak.map.storage.postgres.docker.image", "postgres:alpine"); - private static final PostgreSQLContainer POSTGRES_CONTAINER = new PostgreSQLContainer(POSTGRES_DOCKER_IMAGE_NAME); + private static final PostgreSQLContainer POSTGRES_CONTAINER = new PostgreSQLContainer(DockerImageName.parse(POSTGRES_DOCKER_IMAGE_NAME).asCompatibleSubstituteFor("postgres")); private static final String POSTGRES_DB_DEFAULT_NAME = System.getProperty("keycloak.map.storage.connectionsJpa.databaseName", "keycloak"); private static final String POSTGRES_DB_USER = System.getProperty("keycloak.map.storage.connectionsJpa.user", "keycloak"); private static final String POSTGRES_DB_PASSWORD = System.getProperty("keycloak.map.storage.connectionsJpa.password", "pass");