Skip to content

Commit

Permalink
Replace undertow-map with quarkus-map
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlnarik committed Jul 27, 2022
1 parent 5257b5f commit 143e6bc
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
server: ['quarkus', 'undertow-map', 'wildfly', 'undertow-map-hot-rod']
server: ['quarkus', 'quarkus-map', 'wildfly', 'undertow-map-hot-rod']
tests: ['group1','group2','group3']
fail-fast: false
steps:
Expand Down Expand Up @@ -183,7 +183,7 @@ jobs:
run: |
declare -A PARAMS TESTGROUP
PARAMS["quarkus"]="-Pauth-server-quarkus"
PARAMS["undertow-map"]="-Pauth-server-undertow -Pmap-storage -Dpageload.timeout=90000"
PARAMS["quarkus-map"]="-Pauth-server-quarkus -Pmap-storage -Dpageload.timeout=90000"
PARAMS["undertow-map-hot-rod"]="-Pauth-server-undertow -Pmap-storage,map-storage-hot-rod -Dpageload.timeout=90000"
PARAMS["wildfly"]="-Pauth-server-wildfly"
TESTGROUP["group1"]="-Dtest=!**.crossdc.**,!**.cluster.**,%regex[org.keycloak.testsuite.(a[abc]|ad[a-l]|[^a-q]).*]" # Tests alphabetically before admin tests and those after "r"
Expand Down
2 changes: 2 additions & 0 deletions testsuite/integration-arquillian/tests/base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@
<keycloak.publicKeyCache.enabled>false</keycloak.publicKeyCache.enabled>
<keycloak.userSessionPersister.provider></keycloak.userSessionPersister.provider>
<keycloak.userFederatedStorage.provider></keycloak.userFederatedStorage.provider>
<auth.server.quarkus.mapStorage.profile.config>chm</auth.server.quarkus.mapStorage.profile.config>
</systemPropertyVariables>
</configuration>
</plugin>
Expand Down Expand Up @@ -904,6 +905,7 @@
<keycloak.singleUseObject.map.storage.provider>jpa</keycloak.singleUseObject.map.storage.provider>
<keycloak.user.map.storage.provider>jpa</keycloak.user.map.storage.provider>
<keycloak.userSession.map.storage.provider>jpa</keycloak.userSession.map.storage.provider>
<auth.server.quarkus.mapStorage.profile.config>jpa</auth.server.quarkus.mapStorage.profile.config>
</systemPropertyVariables>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
*/
public class KeycloakQuarkusServerDeployableContainer implements DeployableContainer<KeycloakQuarkusConfiguration> {

private static final String AUTH_SERVER_QUARKUS_MAP_STORAGE_PROFILE = "auth.server.quarkus.mapStorage.profile";

private static final Logger log = Logger.getLogger(KeycloakQuarkusServerDeployableContainer.class);

private KeycloakQuarkusConfiguration configuration;
Expand Down Expand Up @@ -196,25 +198,54 @@ private String[] getProcessCommands() {
commands.add("-Djboss.node.name=" + configuration.getRoute());
}

String mapStorageProfile = System.getProperty(AUTH_SERVER_QUARKUS_MAP_STORAGE_PROFILE);
// only run build during restarts or when running cluster tests

if (restart.get() || "ha".equals(System.getProperty("auth.server.quarkus.cluster.config"))) {
commands.removeIf("--optimized"::equals);
commands.add("--http-relative-path=/auth");

String cacheMode = System.getProperty("auth.server.quarkus.cluster.config", "local");
if (mapStorageProfile == null) {
String cacheMode = System.getProperty("auth.server.quarkus.cluster.config", "local");

if ("local".equals(cacheMode)) {
commands.add("--cache=local");
} else {
commands.add("--cache-config-file=cluster-" + cacheMode + ".xml");
if ("local".equals(cacheMode)) {
commands.add("--cache=local");
} else {
commands.add("--cache-config-file=cluster-" + cacheMode + ".xml");
}
}
}

addStorageOptions(commands);

commands.addAll(getAdditionalBuildArgs());

log.debugf("Quarkus parameters: %s", commands);

return commands.toArray(new String[0]);
}

private void addStorageOptions(List<String> commands) {
String mapStorageProfile = System.getProperty(AUTH_SERVER_QUARKUS_MAP_STORAGE_PROFILE);

if (mapStorageProfile != null) {
switch (mapStorageProfile) {
case "chm":
commands.add("--storage=" + mapStorageProfile);
break;
case "jpa":
commands.add("--storage=" + mapStorageProfile);
commands.add("--db-username=" + System.getProperty("keycloak.map.storage.connectionsJpa.url"));
commands.add("--db-password=" + System.getProperty("keycloak.map.storage.connectionsJpa.user"));
commands.add("--db-url=" + System.getProperty("keycloak.map.storage.connectionsJpa.password"));
case "hotrod":
commands.add("--storage=" + mapStorageProfile);
// TODO: URL / username / password
break;
}
}
}

private void waitForReadiness() throws MalformedURLException, LifecycleException {
SuiteContext suiteContext = this.suiteContext.get();
//TODO: not sure if the best endpoint but it makes sure that everything is properly initialized. Once we have
Expand Down
1 change: 1 addition & 0 deletions testsuite/integration-arquillian/tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,7 @@
<hotrod.store.enabled>true</hotrod.store.enabled>
<skip.copy.hotrod.server>false</skip.copy.hotrod.server>
<cache.server>infinispan</cache.server>
<auth.server.quarkus.mapStorage.profile.config>hotrod</auth.server.quarkus.mapStorage.profile.config>
</properties>
<build>
<plugins>
Expand Down

0 comments on commit 143e6bc

Please sign in to comment.