Move HotRod profile to the same pom as other map profiles and introduce map-storage-chm profile

Closes #16046
This commit is contained in:
Michal Hajas 2022-12-16 18:55:31 +01:00
parent 33e7f1b355
commit c79d29e68c
7 changed files with 148 additions and 86 deletions

View file

@ -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"

View file

@ -195,8 +195,10 @@ public class HotRodMapStorage<K, E extends AbstractHotRodEntity, V extends Abstr
QueryFactory queryFactory = Search.getQueryFactory(remoteCache);
Query<Object[]> 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<Object[]> query = queryFactory.create(queryString);
query.setParameters(iqmcb.getParameters());

View file

@ -22,7 +22,7 @@ import org.infinispan.query.dsl.Query;
* @author <a href="mailto:mkanis@redhat.com">Martin Kanis</a>
*/
public class HotRodUtils {
public static final int DEFAULT_MAX_RESULTS = Integer.MAX_VALUE >> 1;
public static <T> Query<T> paginateQuery(Query<T> 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;

View file

@ -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=<jdbc_url> \
-Dkeycloak.map.storage.connectionsJpa.user=<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=<host> \
-Dkeycloak.connectionsHotRod.port=<port> \

View file

@ -779,7 +779,7 @@
</build>
</profile>
<profile>
<id>map-storage</id>
<id>map-storage-chm</id>
<build>
<plugins>
<plugin>
@ -787,8 +787,10 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<!--
The following properties needs to be synchronized across all map-storage profiles
-->
<keycloak.profile.feature.map_storage>enabled</keycloak.profile.feature.map_storage>
<keycloak.mapStorage.provider>concurrenthashmap</keycloak.mapStorage.provider>
<keycloak.globalLock.provider>none</keycloak.globalLock.provider>
<keycloak.realm.provider>map</keycloak.realm.provider>
<keycloak.client.provider>map</keycloak.client.provider>
@ -810,14 +812,17 @@
<keycloak.publicKeyCache.enabled>false</keycloak.publicKeyCache.enabled>
<keycloak.userSessionPersister.provider></keycloak.userSessionPersister.provider>
<keycloak.userFederatedStorage.provider></keycloak.userFederatedStorage.provider>
<!--
The end of the block synchronized across all map-storage profiles
-->
<keycloak.mapStorage.provider>concurrenthashmap</keycloak.mapStorage.provider>
<auth.server.quarkus.mapStorage.profile.config>chm</auth.server.quarkus.mapStorage.profile.config>
</systemPropertyVariables>
</configuration>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>map-storage-jpa-postgres</id>
<properties>
@ -825,25 +830,39 @@
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireActiveProfile>
<profiles>map-storage</profiles>
<message>map-storage profile not active</message>
</requireActiveProfile>
</rules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<!--
The following properties needs to be synchronized across all map-storage profiles
-->
<keycloak.profile.feature.map_storage>enabled</keycloak.profile.feature.map_storage>
<keycloak.globalLock.provider>none</keycloak.globalLock.provider>
<keycloak.realm.provider>map</keycloak.realm.provider>
<keycloak.client.provider>map</keycloak.client.provider>
<keycloak.clientScope.provider>map</keycloak.clientScope.provider>
<keycloak.group.provider>map</keycloak.group.provider>
<keycloak.role.provider>map</keycloak.role.provider>
<keycloak.user.provider>map</keycloak.user.provider>
<keycloak.deploymentState.provider>map</keycloak.deploymentState.provider>
<keycloak.authSession.provider>map</keycloak.authSession.provider>
<keycloak.userSession.provider>map</keycloak.userSession.provider>
<keycloak.loginFailure.provider>map</keycloak.loginFailure.provider>
<keycloak.authorization.provider>map</keycloak.authorization.provider>
<keycloak.eventsStore.provider>map</keycloak.eventsStore.provider>
<keycloak.singleUseObject.provider>map</keycloak.singleUseObject.provider>
<keycloak.publicKeyStorage.provider>map</keycloak.publicKeyStorage.provider>
<keycloak.authorizationCache.enabled>false</keycloak.authorizationCache.enabled>
<keycloak.realmCache.enabled>false</keycloak.realmCache.enabled>
<keycloak.userCache.enabled>false</keycloak.userCache.enabled>
<keycloak.publicKeyCache.enabled>false</keycloak.publicKeyCache.enabled>
<keycloak.userSessionPersister.provider></keycloak.userSessionPersister.provider>
<keycloak.userFederatedStorage.provider></keycloak.userFederatedStorage.provider>
<!--
The end of the block synchronized across all map-storage profiles
-->
<postgres.start-container>${postgres.start-container}</postgres.start-container>
<keycloak.map.storage.connectionsJpa.url>${keycloak.map.storage.connectionsJpa.url}</keycloak.map.storage.connectionsJpa.url>
@ -871,6 +890,68 @@
</build>
</profile>
<profile>
<id>map-storage-hot-rod</id>
<properties>
<keycloak.testsuite.start-hotrod-container>true</keycloak.testsuite.start-hotrod-container>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<!--
The following properties needs to be synchronized across all map-storage profiles
-->
<keycloak.profile.feature.map_storage>enabled</keycloak.profile.feature.map_storage>
<keycloak.globalLock.provider>none</keycloak.globalLock.provider>
<keycloak.realm.provider>map</keycloak.realm.provider>
<keycloak.client.provider>map</keycloak.client.provider>
<keycloak.clientScope.provider>map</keycloak.clientScope.provider>
<keycloak.group.provider>map</keycloak.group.provider>
<keycloak.role.provider>map</keycloak.role.provider>
<keycloak.user.provider>map</keycloak.user.provider>
<keycloak.deploymentState.provider>map</keycloak.deploymentState.provider>
<keycloak.authSession.provider>map</keycloak.authSession.provider>
<keycloak.userSession.provider>map</keycloak.userSession.provider>
<keycloak.loginFailure.provider>map</keycloak.loginFailure.provider>
<keycloak.authorization.provider>map</keycloak.authorization.provider>
<keycloak.eventsStore.provider>map</keycloak.eventsStore.provider>
<keycloak.singleUseObject.provider>map</keycloak.singleUseObject.provider>
<keycloak.publicKeyStorage.provider>map</keycloak.publicKeyStorage.provider>
<keycloak.authorizationCache.enabled>false</keycloak.authorizationCache.enabled>
<keycloak.realmCache.enabled>false</keycloak.realmCache.enabled>
<keycloak.userCache.enabled>false</keycloak.userCache.enabled>
<keycloak.publicKeyCache.enabled>false</keycloak.publicKeyCache.enabled>
<keycloak.userSessionPersister.provider></keycloak.userSessionPersister.provider>
<keycloak.userFederatedStorage.provider></keycloak.userFederatedStorage.provider>
<!--
The end of the block synchronized across all map-storage profiles
-->
<keycloak.authSession.map.storage.provider>hotrod</keycloak.authSession.map.storage.provider>
<keycloak.client.map.storage.provider>hotrod</keycloak.client.map.storage.provider>
<keycloak.clientScope.map.storage.provider>hotrod</keycloak.clientScope.map.storage.provider>
<keycloak.group.map.storage.provider>hotrod</keycloak.group.map.storage.provider>
<keycloak.role.map.storage.provider>hotrod</keycloak.role.map.storage.provider>
<keycloak.user.map.storage.provider>hotrod</keycloak.user.map.storage.provider>
<keycloak.loginFailure.map.storage.provider>hotrod</keycloak.loginFailure.map.storage.provider>
<keycloak.realm.map.storage.provider>hotrod</keycloak.realm.map.storage.provider>
<keycloak.userSession.map.storage.provider>hotrod</keycloak.userSession.map.storage.provider>
<keycloak.authorization.map.storage.provider>hotrod</keycloak.authorization.map.storage.provider>
<keycloak.eventStore.map.storage.provider>hotrod</keycloak.eventStore.map.storage.provider>
<keycloak.singleUseObject.map.storage.provider>hotrod</keycloak.singleUseObject.map.storage.provider>
<infinispan.version>${infinispan.version}</infinispan.version>
<keycloak.testsuite.start-hotrod-container>${keycloak.testsuite.start-hotrod-container}</keycloak.testsuite.start-hotrod-container>
<auth.server.quarkus.mapStorage.profile.config>hotrod</auth.server.quarkus.mapStorage.profile.config>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>map-storage-jpa-cockroach</id>
<properties>
@ -879,25 +960,39 @@
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireActiveProfile>
<profiles>map-storage</profiles>
<message>map-storage profile not active</message>
</requireActiveProfile>
</rules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<!--
The following properties needs to be synchronized across all map-storage profiles
-->
<keycloak.profile.feature.map_storage>enabled</keycloak.profile.feature.map_storage>
<keycloak.globalLock.provider>none</keycloak.globalLock.provider>
<keycloak.realm.provider>map</keycloak.realm.provider>
<keycloak.client.provider>map</keycloak.client.provider>
<keycloak.clientScope.provider>map</keycloak.clientScope.provider>
<keycloak.group.provider>map</keycloak.group.provider>
<keycloak.role.provider>map</keycloak.role.provider>
<keycloak.user.provider>map</keycloak.user.provider>
<keycloak.deploymentState.provider>map</keycloak.deploymentState.provider>
<keycloak.authSession.provider>map</keycloak.authSession.provider>
<keycloak.userSession.provider>map</keycloak.userSession.provider>
<keycloak.loginFailure.provider>map</keycloak.loginFailure.provider>
<keycloak.authorization.provider>map</keycloak.authorization.provider>
<keycloak.eventsStore.provider>map</keycloak.eventsStore.provider>
<keycloak.singleUseObject.provider>map</keycloak.singleUseObject.provider>
<keycloak.publicKeyStorage.provider>map</keycloak.publicKeyStorage.provider>
<keycloak.authorizationCache.enabled>false</keycloak.authorizationCache.enabled>
<keycloak.realmCache.enabled>false</keycloak.realmCache.enabled>
<keycloak.userCache.enabled>false</keycloak.userCache.enabled>
<keycloak.publicKeyCache.enabled>false</keycloak.publicKeyCache.enabled>
<keycloak.userSessionPersister.provider></keycloak.userSessionPersister.provider>
<keycloak.userFederatedStorage.provider></keycloak.userFederatedStorage.provider>
<!--
The end of the block synchronized across all map-storage profiles
-->
<cockroachdb.start-container>${cockroachdb.start-container}</cockroachdb.start-container>
<keycloak.map.storage.connectionsJpa.url>${keycloak.map.storage.connectionsJpa.url}</keycloak.map.storage.connectionsJpa.url>

View file

@ -48,8 +48,8 @@ public enum StoreProvider {
public void addStoreOptions(List<String> 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") {

View file

@ -1345,45 +1345,6 @@
</build>
</profile>
<profile>
<id>map-storage-hot-rod</id>
<properties>
<keycloak.testsuite.start-hotrod-container>true</keycloak.testsuite.start-hotrod-container>
<auth.server.quarkus.mapStorage.profile.config>hotrod</auth.server.quarkus.mapStorage.profile.config>
</properties>
<build>
<plugins>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<keycloak.authSession.map.storage.provider>hotrod</keycloak.authSession.map.storage.provider>
<keycloak.client.map.storage.provider>hotrod</keycloak.client.map.storage.provider>
<keycloak.clientScope.map.storage.provider>hotrod</keycloak.clientScope.map.storage.provider>
<keycloak.group.map.storage.provider>hotrod</keycloak.group.map.storage.provider>
<keycloak.role.map.storage.provider>hotrod</keycloak.role.map.storage.provider>
<keycloak.user.map.storage.provider>hotrod</keycloak.user.map.storage.provider>
<keycloak.loginFailure.map.storage.provider>hotrod</keycloak.loginFailure.map.storage.provider>
<keycloak.realm.map.storage.provider>hotrod</keycloak.realm.map.storage.provider>
<keycloak.userSession.map.storage.provider>hotrod</keycloak.userSession.map.storage.provider>
<keycloak.authorization.map.storage.provider>hotrod</keycloak.authorization.map.storage.provider>
<keycloak.eventStore.map.storage.provider>hotrod</keycloak.eventStore.map.storage.provider>
<keycloak.singleUseObject.map.storage.provider>hotrod</keycloak.singleUseObject.map.storage.provider>
<infinispan.version>${infinispan.version}</infinispan.version>
<keycloak.testsuite.start-hotrod-container>${keycloak.testsuite.start-hotrod-container}</keycloak.testsuite.start-hotrod-container>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<profile>
<id>auth-server-profile</id>
<activation>