diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/ExternalInfinispanTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/ExternalInfinispanTest.java
index abf10e950d..40c1ae7b9c 100644
--- a/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/ExternalInfinispanTest.java
+++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/storage/database/ExternalInfinispanTest.java
@@ -38,7 +38,7 @@ public class ExternalInfinispanTest {
"start-dev",
"--features=multi-site",
"--cache=ispn",
- "--cache-remote-host=localhost",
+ "--cache-remote-host=127.0.0.1",
"--cache-remote-username=keycloak",
"--cache-remote-password=Password1!",
"--cache-remote-tls-enabled=false",
@@ -56,7 +56,7 @@ public class ExternalInfinispanTest {
"start-dev",
"--features=multi-site,remote-cache",
"--cache=ispn",
- "--cache-remote-host=localhost",
+ "--cache-remote-host=127.0.0.1",
"--cache-remote-username=keycloak",
"--cache-remote-password=Password1!",
"--cache-remote-tls-enabled=false",
diff --git a/quarkus/tests/integration/src/test/resources/ExternalInfinispan/kcb-infinispan-cache-remote-store-config.xml b/quarkus/tests/integration/src/test/resources/ExternalInfinispan/kcb-infinispan-cache-remote-store-config.xml
index b69e7d6ee1..79725b4718 100644
--- a/quarkus/tests/integration/src/test/resources/ExternalInfinispan/kcb-infinispan-cache-remote-store-config.xml
+++ b/quarkus/tests/integration/src/test/resources/ExternalInfinispan/kcb-infinispan-cache-remote-store-config.xml
@@ -53,7 +53,7 @@
raw-values="true"
shared="true"
segmented="false">
-
@@ -77,7 +77,7 @@
raw-values="true"
shared="true"
segmented="false">
-
@@ -100,7 +100,7 @@
raw-values="true"
shared="true"
segmented="false">
-
@@ -123,7 +123,7 @@
raw-values="true"
shared="true"
segmented="false">
-
@@ -146,7 +146,7 @@
raw-values="true"
shared="true"
segmented="false">
-
@@ -169,7 +169,7 @@
raw-values="true"
shared="true"
segmented="false">
-
@@ -199,7 +199,7 @@
raw-values="true"
shared="true"
segmented="false">
-
@@ -235,7 +235,7 @@
raw-values="true"
shared="true"
segmented="false">
-
diff --git a/quarkus/tests/junit5/pom.xml b/quarkus/tests/junit5/pom.xml
index ef3d7f360b..7d9b450c89 100644
--- a/quarkus/tests/junit5/pom.xml
+++ b/quarkus/tests/junit5/pom.xml
@@ -53,6 +53,10 @@
keycloak-quarkus-dist
zip
+
+ org.infinispan
+ infinispan-server-testdriver-core
+
junit
diff --git a/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/InfinispanContainer.java b/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/InfinispanContainer.java
index 0081fe0283..7c1b924452 100644
--- a/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/InfinispanContainer.java
+++ b/quarkus/tests/junit5/src/main/java/org/keycloak/it/junit5/extension/InfinispanContainer.java
@@ -17,44 +17,39 @@
package org.keycloak.it.junit5.extension;
-import java.time.Duration;
import java.util.Arrays;
import org.infinispan.client.hotrod.RemoteCacheManager;
-import org.infinispan.client.hotrod.configuration.ClientIntelligence;
-import org.infinispan.client.hotrod.configuration.ConfigurationBuilder;
import org.infinispan.commons.configuration.StringConfiguration;
import org.jboss.logging.Logger;
import org.keycloak.connections.infinispan.InfinispanConnectionProvider;
-import org.testcontainers.containers.GenericContainer;
-import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.images.PullPolicy;
-public class InfinispanContainer extends GenericContainer {
+public class InfinispanContainer extends org.infinispan.server.test.core.InfinispanContainer {
private final Logger LOG = Logger.getLogger(getClass());
public static final String PORT = System.getProperty("keycloak.externalInfinispan.port", "11222");
public static final String USERNAME = System.getProperty("keycloak.externalInfinispan.username", "keycloak");
public static final String PASSWORD = System.getProperty("keycloak.externalInfinispan.password", DatabaseContainer.DEFAULT_PASSWORD);
- public static RemoteCacheManager remoteCacheManager;
+ private static RemoteCacheManager remoteCacheManager;
@SuppressWarnings("resource")
public InfinispanContainer() {
super(getImageName());
- withEnv("USER", USERNAME);
- withEnv("PASS", PASSWORD);
- withNetworkMode("host");
+ withUser(USERNAME);
+ withPassword(PASSWORD);
+
+ // Keycloak expects Infinispan to run on fixed ports
+ getExposedPorts().forEach(i -> {
+ addFixedExposedPort(i, i);
+ });
// the images in the 'infinispan-test' repository point to tags that are frequently refreshed, therefore, always pull them
if (getImageName().startsWith("quay.io/infinispan-test")) {
withImagePullPolicy(PullPolicy.alwaysPull());
}
-
- //order of waitingFor and withStartupTimeout matters as the latter sets the timeout for WaitStrategy set by waitingFor
- waitingFor(Wait.forLogMessage(".*Infinispan Server.*started in.*", 1));
- withStartupTimeout(Duration.ofMinutes(5));
}
private static String getImageName() {
@@ -77,18 +72,7 @@ public class InfinispanContainer extends GenericContainer {
}
private void establishHotRodConnection() {
- ConfigurationBuilder configBuilder = new ConfigurationBuilder()
- .addServers(getHost() + ":11222")
- .security()
- .authentication()
- .username(getUsername())
- .password(getPassword())
- .clientIntelligence(ClientIntelligence.BASIC);
-
- configBuilder.statistics().enable()
- .statistics().jmxEnable();
-
- remoteCacheManager = new RemoteCacheManager(configBuilder.build());
+ remoteCacheManager = getRemoteCacheManager();
}
@Override