Skip to content

Commit

Permalink
Merge pull request quarkusio#18856 from sberyozkin/dev_console_keyclo…
Browse files Browse the repository at this point in the history
…ak_smoke_test

Add a Dev Console smoke test for Keycloak
  • Loading branch information
sberyozkin authored Jul 21, 2021
2 parents d34e20b + 35fd05d commit fa6cd08
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private DevServicesConfigBuildItem prepareConfiguration(boolean createRealm,
private StartResult startContainer() {
if (!capturedDevServicesConfiguration.enabled) {
// explicitly disabled
LOG.error("Not starting devservices for Keycloak as it has been disabled in the config");
LOG.debug("Not starting devservices for Keycloak as it has been disabled in the config");
return null;
}
if (!isOidcTenantEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{#if info:oidcProviderUrlBase}
{#if info:oidcProviderUrlBase??}
<a href="{info:oidcProviderUrlBase}/provider" class="badge badge-light">
<i class="fa fa-boxes fa-fw"></i>
Provider: <span class="badge badge-light">{info:oidcProviderName}</span></a>
{#else if info:keycloakUrl}
{#else if info:keycloakUrl??}
<a href="{urlbase}/provider" class="badge badge-light">
<i class="fa fa-boxes fa-fw"></i>
Provider: <span class="badge badge-light">Keycloak</span></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,16 @@
{#body}
<p/>

{#if info:keycloakUrl??}
<div class="float-right">
<a href="{info:keycloakUrl}" target="_blank" class="btn btn-link" title="Log into Keycloak to Configure Realms">
<i class="fas fa-key"></i> Keycloak Admin
</a>
</div>
{/if}

<div class="container">
{#if info:oidcApplicationType is 'service'}
{#if info:oidcApplicationType?? is 'service'}
{#if info:oidcGrantType is 'implicit'}

<div class="card implicitLoggedOut">
Expand Down
14 changes: 14 additions & 0 deletions integration-tests/devmode/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
<artifactId>quarkus-resteasy-reactive-deployment</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc-deployment</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-scheduler-deployment</artifactId>
Expand Down Expand Up @@ -109,6 +114,15 @@
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>false</skip>
<systemPropertyVariables>
<quarkus.keycloak.devservices.enabled>false</quarkus.keycloak.devservices.enabled>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.quarkus.test.devconsole;

import org.hamcrest.Matchers;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusDevModeTest;
import io.restassured.RestAssured;

/**
* Note that this test cannot be placed under the relevant {@code -deployment} module because then the DEV UI processor would
* not be able to locate the template resources correctly.
*/
public class DevConsoleOidcSmokeTest {

@RegisterExtension
static final QuarkusDevModeTest config = new QuarkusDevModeTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class));

@Test
public void testCaches() {
RestAssured.get("q/dev/io.quarkus.quarkus-oidc/provider")
.then()
.statusCode(200).body(Matchers.containsString("Keycloak"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public class NoSrcMainUnitTest {
static final QuarkusUnitTest TEST = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClass(NoSrcMainResource.class)
.addAsResource(new StringAsset("test.message = Hello from NoSrcMainUnitTest"),
.addAsResource(new StringAsset("test.message = Hello from NoSrcMainUnitTest\n"
+ "quarkus.oidc.tenant-enabled=false"),
"application.properties"));

@Test
Expand Down

0 comments on commit fa6cd08

Please sign in to comment.