KEYCLOAK-13770 Working FixedHostnameTest for Quarkus
This commit is contained in:
parent
12c7bc7350
commit
82964f7460
3 changed files with 17 additions and 15 deletions
|
@ -98,7 +98,7 @@ public class KeycloakQuarkusServerDeployableContainer implements DeployableConta
|
|||
|
||||
try {
|
||||
deployArchiveToServer(archive);
|
||||
restartServer();
|
||||
restartServer(true);
|
||||
} catch (Exception e) {
|
||||
throw new DeploymentException(e.getMessage(),e);
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public class KeycloakQuarkusServerDeployableContainer implements DeployableConta
|
|||
File wrkDir = configuration.getProvidersPath().resolve("providers").toFile();
|
||||
try {
|
||||
Files.deleteIfExists(wrkDir.toPath().resolve(archive.getName()));
|
||||
restartServer();
|
||||
restartServer(true);
|
||||
} catch (Exception e) {
|
||||
throw new DeploymentException(e.getMessage(),e);
|
||||
}
|
||||
|
@ -149,7 +149,6 @@ public class KeycloakQuarkusServerDeployableContainer implements DeployableConta
|
|||
List<String> commands = new ArrayList<>(Arrays.asList("./kc.sh", "config", "-Dquarkus.http.root-path=/auth", "--http-enabled=true"));
|
||||
|
||||
addAdditionalCommands(commands);
|
||||
|
||||
ProcessBuilder reaugment = new ProcessBuilder(commands);
|
||||
|
||||
reaugment.directory(wrkDir).inheritIO();
|
||||
|
@ -311,8 +310,10 @@ public class KeycloakQuarkusServerDeployableContainer implements DeployableConta
|
|||
Files.copy(zipStream, providersDir.toPath().resolve(archive.getName()), StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
|
||||
private void restartServer() throws Exception {
|
||||
private void restartServer(boolean isReaugmentation) throws Exception {
|
||||
if(isReaugmentation) {
|
||||
forceReaugmentation = true;
|
||||
}
|
||||
stop();
|
||||
start();
|
||||
}
|
||||
|
|
|
@ -3,11 +3,9 @@ package org.keycloak.testsuite.url;
|
|||
import org.jboss.arquillian.container.test.api.ContainerController;
|
||||
import org.jboss.arquillian.test.api.ArquillianResource;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.common.util.SystemEnvProperties;
|
||||
import org.keycloak.testsuite.AbstractKeycloakTest;
|
||||
import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
|
||||
import org.keycloak.testsuite.arquillian.containers.KeycloakQuarkusServerDeployableContainer;
|
||||
import org.wildfly.extras.creaper.core.online.ModelNodeResult;
|
||||
import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
|
||||
import org.wildfly.extras.creaper.core.online.operations.admin.Administration;
|
||||
|
||||
|
@ -18,6 +16,8 @@ public abstract class AbstractHostnameTest extends AbstractKeycloakTest {
|
|||
|
||||
private static final Logger LOGGER = Logger.getLogger(AbstractHostnameTest.class);
|
||||
|
||||
private boolean isReaugmentationNeeded;
|
||||
|
||||
@ArquillianResource
|
||||
protected ContainerController controller;
|
||||
|
||||
|
@ -42,7 +42,7 @@ public abstract class AbstractHostnameTest extends AbstractKeycloakTest {
|
|||
} else if (suiteContext.getAuthServerInfo().isQuarkus()) {
|
||||
controller.stop(suiteContext.getAuthServerInfo().getQualifier());
|
||||
KeycloakQuarkusServerDeployableContainer container = (KeycloakQuarkusServerDeployableContainer)suiteContext.getAuthServerInfo().getArquillianContainer().getDeployableContainer();
|
||||
container.resetConfiguration(false);
|
||||
container.resetConfiguration(isReaugmentationNeeded);
|
||||
controller.start(suiteContext.getAuthServerInfo().getQualifier());
|
||||
} else {
|
||||
throw new RuntimeException("Don't know how to config");
|
||||
|
@ -81,6 +81,7 @@ public abstract class AbstractHostnameTest extends AbstractKeycloakTest {
|
|||
}
|
||||
container.setRuntimeProperties(runtimeProperties);
|
||||
controller.start(suiteContext.getAuthServerInfo().getQualifier());
|
||||
isReaugmentationNeeded = false;
|
||||
} else {
|
||||
throw new RuntimeException("Don't know how to config");
|
||||
}
|
||||
|
@ -105,13 +106,13 @@ public abstract class AbstractHostnameTest extends AbstractKeycloakTest {
|
|||
} else if (suiteContext.getAuthServerInfo().isQuarkus()) {
|
||||
controller.stop(suiteContext.getAuthServerInfo().getQualifier());
|
||||
KeycloakQuarkusServerDeployableContainer container = (KeycloakQuarkusServerDeployableContainer)suiteContext.getAuthServerInfo().getArquillianContainer().getDeployableContainer();
|
||||
List<String> runtimeProperties = new ArrayList<>();
|
||||
runtimeProperties.add("--spi-hostname-fixed-hostname="+hostname);
|
||||
runtimeProperties.add("--spi-hostname-fixed-http-port="+ httpPort);
|
||||
runtimeProperties.add("--spi-hostname-fixed-https-port="+ httpsPort);
|
||||
runtimeProperties.add("--spi-hostname-fixed-always-https="+ alwaysHttps);
|
||||
container.setRuntimeProperties(runtimeProperties);
|
||||
container.forceReAugmentation("--spi-hostname-provider=fixed" +
|
||||
" --spi-hostname-fixed-hostname="+ hostname +
|
||||
" --spi-hostname-fixed-http-port="+ httpPort +
|
||||
" --spi-hostname-fixed-https-port="+ httpsPort +
|
||||
" --spi-hostname-fixed-always-https="+ alwaysHttps);
|
||||
controller.start(suiteContext.getAuthServerInfo().getQualifier());
|
||||
isReaugmentationNeeded = true;
|
||||
} else {
|
||||
throw new RuntimeException("Don't know how to config");
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ import static org.keycloak.testsuite.util.ServerURLs.getAuthServerContextRoot;
|
|||
import static org.keycloak.testsuite.arquillian.annotation.AuthServerContainerExclude.AuthServer.QUARKUS;
|
||||
import static org.keycloak.testsuite.arquillian.annotation.AuthServerContainerExclude.AuthServer.REMOTE;
|
||||
|
||||
@AuthServerContainerExclude({REMOTE, QUARKUS})
|
||||
@AuthServerContainerExclude({REMOTE})
|
||||
public class FixedHostnameTest extends AbstractHostnameTest {
|
||||
|
||||
public static final String SAML_CLIENT_ID = "http://whatever.hostname:8280/app/";
|
||||
|
|
Loading…
Reference in a new issue