Skip to content

Commit

Permalink
cache-embedded-mtls-enabled is ignored
Browse files Browse the repository at this point in the history
Fixes #34644

Signed-off-by: Pedro Ruivo <[email protected]>
  • Loading branch information
pruivo authored and ahus1 committed Nov 5, 2024
1 parent 8853a94 commit 36defd5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ private static int getStartTimeout() {

private static void configureTransportStack(ConfigurationBuilderHolder builder, EntityManager em) {
var transportConfig = builder.getGlobalConfigurationBuilder().transport();
if (Configuration.isTrue(CachingOptions.CACHE_EMBEDDED_MTLS_ENABLED_PROPERTY)) {
if (Configuration.isTrue(CachingOptions.CACHE_EMBEDDED_MTLS_ENABLED)) {
validateTlsAvailable(transportConfig.build());
var tls = new TLS()
.enabled(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.nio.file.Paths;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.keycloak.quarkus.runtime.cli.command.Main.CONFIG_FILE_LONG_NAME;

@DistributionTest
Expand Down Expand Up @@ -96,25 +97,32 @@ public void testExpressionsInConfigFile(KeycloakDistribution distribution) {
result.assertMessage("- log-syslog-app-name: Available only when Syslog is activated.");
}

@Test
@Order(7)
@Launch({"start", "--cache-embedded-mtls-enabled=true", "--http-enabled=true", "--hostname-strict=false"})
public void testCacheEmbeddedMtlsEnabled(LaunchResult result) {
assertTrue(result.getOutputStream().stream().anyMatch(s -> s.contains("Property cache-embedded-mtls-key-store-file required but not specified")));
}

// Start-dev should be executed as last tests - build is done for development mode

@Test
@Order(7)
@Order(8)
@Launch({"start-dev", "--test=invalid"})
public void testServerDoesNotStartIfValidationFailDuringReAugStartDev(LaunchResult result) {
assertEquals(1, result.getErrorStream().stream().filter(s -> s.contains("Unknown option: '--test'")).count());
}

@Test
@Order(8)
@Order(9)
@Launch({"start-dev", "--log=console", "--log-file-output=json"})
public void testServerDoesNotStartDevIfDisabledFileLogOption(LaunchResult result) {
assertEquals(1, result.getErrorStream().stream().filter(s -> s.contains("Disabled option: '--log-file-output'. Available only when File log handler is activated")).count());
assertEquals(1, result.getErrorStream().stream().filter(s -> s.contains("Possible solutions: --log, --log-console-output, --log-console-level, --log-console-format, --log-console-color, --log-level")).count());
}

@Test
@Order(9)
@Order(10)
@Launch({"start-dev", "--log=file", "--log-file-output=json", "--log-console-color=true"})
public void testServerStartDevIfEnabledFileLogOption(LaunchResult result) {
assertEquals(0, result.getErrorStream().stream().filter(s -> s.contains("Disabled option: '--log-file-output'. Available only when File log handler is activated")).count());
Expand Down

0 comments on commit 36defd5

Please sign in to comment.