Skip to content

Commit

Permalink
add withVerboseOutput() to enable verbose error messages
Browse files Browse the repository at this point in the history
 closes #114
  • Loading branch information
dasniko committed Sep 8, 2023
1 parent 16bbfff commit 7b00199
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public abstract class ExtendableKeycloakContainer<SELF extends ExtendableKeycloa
private boolean metricsEnabled = false;
private HttpsClientAuth httpsClientAuth = HttpsClientAuth.NONE;

private boolean useVerbose = false;
private String[] featuresEnabled = null;
private String[] featuresDisabled = null;

Expand Down Expand Up @@ -120,6 +121,9 @@ public ExtendableKeycloakContainer(String dockerImageName) {
@Override
protected void configure() {
List<String> commandParts = new ArrayList<>();
if (useVerbose) {
commandParts.add("--verbose");
}
commandParts.add("start-dev");

if (!contextPath.equals(KEYCLOAK_CONTEXT_PATH)) {
Expand Down Expand Up @@ -335,6 +339,11 @@ public SELF useMutualTls(String tlsTruststoreFilename, String tlsTruststorePassw
return self();
}

public SELF withVerboseOutput() {
this.useVerbose = true;
return self();
}

public SELF withFeaturesEnabled(String... features) {
this.featuresEnabled = features;
return self();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ public void shouldExposeMetricsWithEnabledMetrics() {
}
}

@Test
public void shouldStartKeycloakVerbose() {
try (KeycloakContainer keycloak = new KeycloakContainer().withVerboseOutput()) {
keycloak.start();
}
}

private void checkKeycloakContainerInternals(KeycloakContainer keycloak) {
Keycloak keycloakAdminClient = keycloak.getKeycloakAdminClient();
ServerInfoRepresentation serverInfo = keycloakAdminClient.serverInfo().getInfo();
Expand Down

0 comments on commit 7b00199

Please sign in to comment.