cache-embedded-mtls-enabled is ignored

Fixes #34644

Signed-off-by: Pedro Ruivo <pruivo@redhat.com>
This commit is contained in:
Pedro Ruivo 2024-11-05 15:20:08 +00:00 committed by Alexander Schwartz
parent 8853a942f9
commit 36defd5f33
2 changed files with 12 additions and 4 deletions

View file

@ -401,7 +401,7 @@ public class CacheManagerFactory {
private static void configureTransportStack(ConfigurationBuilderHolder builder, EntityManager em) { private static void configureTransportStack(ConfigurationBuilderHolder builder, EntityManager em) {
var transportConfig = builder.getGlobalConfigurationBuilder().transport(); 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()); validateTlsAvailable(transportConfig.build());
var tls = new TLS() var tls = new TLS()
.enabled(true) .enabled(true)

View file

@ -33,6 +33,7 @@ import org.keycloak.it.utils.KeycloakDistribution;
import java.nio.file.Paths; import java.nio.file.Paths;
import static org.junit.jupiter.api.Assertions.assertEquals; 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; import static org.keycloak.quarkus.runtime.cli.command.Main.CONFIG_FILE_LONG_NAME;
@DistributionTest @DistributionTest
@ -96,17 +97,24 @@ public class OptionsDistTest {
result.assertMessage("- log-syslog-app-name: Available only when Syslog is activated."); 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 // Start-dev should be executed as last tests - build is done for development mode
@Test @Test
@Order(7) @Order(8)
@Launch({"start-dev", "--test=invalid"}) @Launch({"start-dev", "--test=invalid"})
public void testServerDoesNotStartIfValidationFailDuringReAugStartDev(LaunchResult result) { public void testServerDoesNotStartIfValidationFailDuringReAugStartDev(LaunchResult result) {
assertEquals(1, result.getErrorStream().stream().filter(s -> s.contains("Unknown option: '--test'")).count()); assertEquals(1, result.getErrorStream().stream().filter(s -> s.contains("Unknown option: '--test'")).count());
} }
@Test @Test
@Order(8) @Order(9)
@Launch({"start-dev", "--log=console", "--log-file-output=json"}) @Launch({"start-dev", "--log=console", "--log-file-output=json"})
public void testServerDoesNotStartDevIfDisabledFileLogOption(LaunchResult result) { 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("Disabled option: '--log-file-output'. Available only when File log handler is activated")).count());
@ -114,7 +122,7 @@ public class OptionsDistTest {
} }
@Test @Test
@Order(9) @Order(10)
@Launch({"start-dev", "--log=file", "--log-file-output=json", "--log-console-color=true"}) @Launch({"start-dev", "--log=file", "--log-file-output=json", "--log-console-color=true"})
public void testServerStartDevIfEnabledFileLogOption(LaunchResult result) { 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()); assertEquals(0, result.getErrorStream().stream().filter(s -> s.contains("Disabled option: '--log-file-output'. Available only when File log handler is activated")).count());