diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Picocli.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Picocli.java index 2a75195afa..e52044aef5 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Picocli.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/cli/Picocli.java @@ -336,12 +336,14 @@ public final class Picocli { if (!PropertyMappers.isDisabledMapper(mapper.getFrom())) { continue; // we found enabled mapper with the same name } - final boolean deniedPrintException = mapper.isRunTime() && isRebuild(); - if (PropertyMapper.isCliOption(configValue) && !deniedPrintException) { - throw new KcUnmatchedArgumentException(abstractCommand.getCommandLine(), List.of(mapper.getCliFormat())); - } else { - handleDisabled(mapper.isRunTime() ? disabledRunTime : disabledBuildTime, mapper); + // only check build-time for a rebuild, we'll check the runtime later + if (!mapper.isRunTime() || !isRebuild()) { + if (PropertyMapper.isCliOption(configValue)) { + throw new KcUnmatchedArgumentException(abstractCommand.getCommandLine(), List.of(mapper.getCliFormat())); + } else { + handleDisabled(mapper.isRunTime() ? disabledRunTime : disabledBuildTime, mapper); + } } continue; } diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/LoggingDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/LoggingDistTest.java index ecd763584c..d300669035 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/LoggingDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/LoggingDistTest.java @@ -17,13 +17,11 @@ package org.keycloak.it.cli.dist; -import static org.awaitility.Awaitility.given; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.keycloak.quarkus.runtime.cli.command.Main.CONFIG_FILE_LONG_NAME; import com.fasterxml.jackson.core.JsonProcessingException; -import io.restassured.RestAssured; import org.junit.jupiter.api.Test; import org.keycloak.config.LoggingOptions; import org.keycloak.it.junit5.extension.CLIResult; @@ -33,8 +31,6 @@ import org.keycloak.it.junit5.extension.RawDistOnly; import io.quarkus.test.junit.main.Launch; import io.quarkus.test.junit.main.LaunchResult; -import static io.restassured.RestAssured.when; - import org.keycloak.it.utils.KeycloakDistribution; import org.keycloak.it.utils.RawDistRootPath; import org.testcontainers.shaded.org.apache.commons.io.FileUtils; @@ -99,8 +95,6 @@ public class LoggingDistTest { void testJsonFormatApplied(LaunchResult result) throws JsonProcessingException { CLIResult cliResult = (CLIResult) result; - cliResult.assertMessage("The following used run time options are UNAVAILABLE and will be ignored during build time:"); - cliResult.assertMessage("- log-console-output: Available only when Console log handler is activated."); cliResult.assertJsonLogDefaultsApplied(); cliResult.assertStartedDevMode(); } diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/StartCommandDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/StartCommandDistTest.java index f26631a1ed..38eff32471 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/StartCommandDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/StartCommandDistTest.java @@ -109,6 +109,13 @@ public class StartCommandDistTest { cliResult.assertError("Build time option: '--db' not usable with pre-built image and --optimized"); } + @Test + @Launch({ "start", "--http-enabled=true", "--cache-remote-host=localhost", "--hostname-strict=false", "--cache-remote-tls-enabled=false", "--transaction-xa-enabled=true" }) + void testStartNoWarningOnDisabledRuntimeOption(LaunchResult result) { + CLIResult cliResult = (CLIResult) result; + cliResult.assertNoMessage("cache-remote-tls-enabled: Available only when remote host is set"); + } + @Test @WithEnvVars({"KC_LOG", "invalid"}) @Launch({ "start", "--optimized" })