fix: remove runtime related warnings from rebuild (#29110)

closes: #28948

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
Steven Hawkins 2024-05-02 10:34:08 -04:00 committed by GitHub
parent 45e5e6cbbf
commit f3227c325a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 11 deletions

View file

@ -336,13 +336,15 @@ 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) {
// 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;
}

View file

@ -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();
}

View file

@ -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" })