diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2a2fef366..470802a528 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -225,10 +225,10 @@ jobs: - name: Run base tests run: | declare -A PARAMS - PARAMS["chm"]="-Pmap-storage -Dpageload.timeout=90000" - PARAMS["hot-rod"]="-Pmap-storage,map-storage-hot-rod -Dpageload.timeout=90000" - PARAMS["jpa-postgres"]="-Pmap-storage,map-storage-jpa-postgres -Dpageload.timeout=90000" - PARAMS["jpa-cockroach"]="-Pmap-storage,map-storage-jpa-cockroach -Dpageload.timeout=90000" + PARAMS["chm"]="-Pmap-storage-chm -Dpageload.timeout=90000" + PARAMS["hot-rod"]="-Pmap-storage-hot-rod -Dpageload.timeout=90000" + PARAMS["jpa-postgres"]="-Pmap-storage-jpa-postgres -Dpageload.timeout=90000" + PARAMS["jpa-cockroach"]="-Pmap-storage-jpa-cockroach -Dpageload.timeout=90000" TESTS=`testsuite/integration-arquillian/tests/base/testsuites/suite.sh database` echo "Tests: $TESTS" diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/HotRodMapStorage.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/HotRodMapStorage.java index 90ded7cd3d..250cc9d2c5 100644 --- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/HotRodMapStorage.java +++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/HotRodMapStorage.java @@ -195,8 +195,10 @@ public class HotRodMapStorage query = paginateQuery(queryFactory.create(queryString), queryParameters.getOffset(), - queryParameters.getLimit()); + if (queryParameters.getLimit() != null || queryParameters.getOffset() != null) { + throw new IllegalArgumentException("HotRod storage does not support pagination for delete query"); + } + Query query = queryFactory.create(queryString); query.setParameters(iqmcb.getParameters()); diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodUtils.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodUtils.java index 4fedfd0d51..2a01cc17c1 100644 --- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodUtils.java +++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodUtils.java @@ -22,7 +22,7 @@ import org.infinispan.query.dsl.Query; * @author Martin Kanis */ public class HotRodUtils { - + public static final int DEFAULT_MAX_RESULTS = Integer.MAX_VALUE >> 1; public static Query paginateQuery(Query query, Integer first, Integer max) { if (first != null && first > 0) { query = query.startOffset(first); @@ -30,6 +30,10 @@ public class HotRodUtils { if (max != null && max >= 0) { query = query.maxResults(max); + } else { + // Infinispan uses default max value equal to 100 + // We need to change this to support more returned values + query = query.maxResults(DEFAULT_MAX_RESULTS); } return query; diff --git a/testsuite/integration-arquillian/HOW-TO-RUN.md b/testsuite/integration-arquillian/HOW-TO-RUN.md index e7ea8990f3..e846dde2f0 100644 --- a/testsuite/integration-arquillian/HOW-TO-RUN.md +++ b/testsuite/integration-arquillian/HOW-TO-RUN.md @@ -832,7 +832,7 @@ we rely on [nip.io](https://nip.io) for DNS switching, so tests will work everyw To run base testsuite with new storage run the following command (this will execute testsuite with ConcurrentHashMap storage): ```shell mvn clean install -f testsuite/integration-arquillian/tests/base \ - -Pauth-server-quarkus -Pmap-storage + -Pauth-server-quarkus -Pmap-storage-chm ``` ### Running tests with JPA Map storage @@ -849,7 +849,7 @@ version, use the system property `keycloak.map.storage.cockroachdb.docker.image` Execute tests: ```shell mvn clean install -f testsuite/integration-arquillian/tests/base \ - -Pmap-storage,map-storage-jpa-postgres + -Pmap-storage-jpa-postgres ``` It's also possible to configure tests to connect to an external database, it might be useful @@ -864,7 +864,7 @@ podman run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=pass -e POSTGRES_US To run the tests without spawning the container for you, execute tests with the following command: ```shell mvn clean install -f testsuite/integration-arquillian/tests/base \ - -Pmap-storage,map-storage-jpa-postgres \ + -Pmap-storage-jpa-postgres \ -Dpostgres.start-container=false \ -Dkeycloak.map.storage.connectionsJpa.url= \ -Dkeycloak.map.storage.connectionsJpa.user= \ @@ -877,7 +877,7 @@ By default, Base testsuite with `map-storage-hotrod` profile spawn a new Infinis with each test execution. To run the tests execute: ```shell mvn clean install -f testsuite/integration-arquillian/tests/base \ - -Pmap-storage,map-storage-hotrod + -Pmap-storage-hotrod ``` Note: For running Infinispan server we are using Testcontainer, see section _Usage of Testcontainers_ for details on how to set up your container engine. @@ -887,7 +887,7 @@ connect to an external instance of Infinispan. To do so, execute tests with the following command: ```shell mvn clean install -f testsuite/integration-arquillian/tests/base \ - -Pmap-storage,map-storage-hotrod + -Pmap-storage-hotrod -Dkeycloak.testsuite.start-hotrod-container=false \ -Dkeycloak.connectionsHotRod.host= \ -Dkeycloak.connectionsHotRod.port= \ diff --git a/testsuite/integration-arquillian/tests/base/pom.xml b/testsuite/integration-arquillian/tests/base/pom.xml index e0f6ad1308..89bff77c5a 100644 --- a/testsuite/integration-arquillian/tests/base/pom.xml +++ b/testsuite/integration-arquillian/tests/base/pom.xml @@ -779,7 +779,7 @@ - map-storage + map-storage-chm @@ -787,8 +787,10 @@ maven-surefire-plugin + enabled - concurrenthashmap none map map @@ -810,14 +812,17 @@ false + + concurrenthashmap chm - - + + - map-storage-jpa-postgres @@ -825,25 +830,39 @@ - - maven-enforcer-plugin - - enforce - - - - - map-storage - map-storage profile not active - - - - org.apache.maven.plugins maven-surefire-plugin + + enabled + none + map + map + map + map + map + map + map + map + map + map + map + map + map + map + false + false + false + false + + + ${postgres.start-container} ${keycloak.map.storage.connectionsJpa.url} @@ -871,6 +890,68 @@ + + map-storage-hot-rod + + true + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + enabled + none + map + map + map + map + map + map + map + map + map + map + map + map + map + map + false + false + false + false + + + + hotrod + hotrod + hotrod + hotrod + hotrod + hotrod + hotrod + hotrod + hotrod + hotrod + hotrod + hotrod + ${infinispan.version} + ${keycloak.testsuite.start-hotrod-container} + hotrod + + + + + + + map-storage-jpa-cockroach @@ -879,25 +960,39 @@ - - maven-enforcer-plugin - - enforce - - - - - map-storage - map-storage profile not active - - - - org.apache.maven.plugins maven-surefire-plugin + + enabled + none + map + map + map + map + map + map + map + map + map + map + map + map + map + map + false + false + false + false + + + ${cockroachdb.start-container} ${keycloak.map.storage.connectionsJpa.url} diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/model/StoreProvider.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/model/StoreProvider.java index 7742296cb2..29faf419f5 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/model/StoreProvider.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/model/StoreProvider.java @@ -48,8 +48,8 @@ public enum StoreProvider { public void addStoreOptions(List commands) { commands.add("--storage=" + getAlias()); commands.add("--storage-hotrod-host='" + System.getProperty("keycloak.connectionsHotRod.host") + "'"); - commands.add("--storage-hotrod-username" + System.getProperty("keycloak.connectionsHotRod.username")); - commands.add("--storage-hotrod-password" + System.getProperty("keycloak.connectionsHotRod.password")); + commands.add("--storage-hotrod-username=" + System.getProperty("keycloak.connectionsHotRod.username", "admin")); + commands.add("--storage-hotrod-password=" + System.getProperty("keycloak.connectionsHotRod.password", "admin")); } }, LEGACY("legacy") { diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml index 9ae41d1243..84ad28e446 100644 --- a/testsuite/integration-arquillian/tests/pom.xml +++ b/testsuite/integration-arquillian/tests/pom.xml @@ -1345,45 +1345,6 @@ - - map-storage-hot-rod - - true - hotrod - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - hotrod - hotrod - hotrod - hotrod - hotrod - hotrod - hotrod - hotrod - hotrod - hotrod - hotrod - hotrod - ${infinispan.version} - ${keycloak.testsuite.start-hotrod-container} - - - - - - - - - auth-server-profile