Added the shutdown delay and shutdown timeout for the testcases to default options

Closes #46337

Signed-off-by: Ruchika <ruchika.jha1@ibm.com>
This commit is contained in:
Ruchika Jha 2026-02-24 13:47:04 +00:00 committed by GitHub
parent 46f648dc95
commit 9ec61bfb52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 32 additions and 4 deletions

View file

@ -13,6 +13,8 @@ spec:
value: postgres
- name: db-password
value: testpassword
- name: shutdown-delay
value: "0s"
hostname:
hostname: example.com
unsupported:

View file

@ -13,6 +13,8 @@ spec:
value: postgres
- name: db-password
value: testpassword
- name: shutdown-delay
value: "0s"
hostname:
hostname: example.com
unsupported:

View file

@ -21,4 +21,6 @@ spec:
headers: xforwarded # default nginx ingress sets x-forwarded
additionalOptions:
- name: metrics-enabled
value: "true"
value: "true"
- name: shutdown-delay
value: "0s"

View file

@ -66,7 +66,12 @@ class BuildCommandDistTest {
@Test
@Launch({ "build", "--db=postgres", "--db-username=myuser", "--db-password=mypassword", "--http-enabled=true" })
void testIgnoreRuntimeOptions(CLIResult cliResult) {
cliResult.assertMessage("The following run time options were found, but will be ignored during build time: kc.db-username, kc.http-enabled, kc.db-password");
String output = cliResult.getOutput();
assertTrue(output.contains("The following run time options were found, but will be ignored during build time:"));
assertTrue(output.contains("kc.db-username"));
assertTrue(output.contains("kc.http-enabled"));
assertTrue(output.contains("kc.db-password"));
assertTrue(output.contains("kc.shutdown-delay"));
cliResult.assertBuild();
}

View file

@ -41,9 +41,8 @@ public class KeycloakDistributionDecorator implements KeycloakDistribution {
@Override
public CLIResult run(List<String> rawArgs) {
List<String> args = new ArrayList<>(rawArgs);
args.addAll(List.of(config.defaultOptions()));
setEnvVar("KC_SHUTDOWN_DELAY", "0s");
return delegate.run(new ServerOptions(storageConfig, databaseConfig, args));
}

View file

@ -27,6 +27,8 @@ public class KeycloakServerConfigBuilder {
private final Set<KeycloakDependency> dependencies = new HashSet<>();
private CacheType cacheType = CacheType.LOCAL;
private boolean externalInfinispan = false;
private String shutdownDelay = "0s";
private String shutdownTimeout = "1s";
private KeycloakServerConfigBuilder(String command) {
this.command = command;
@ -93,6 +95,16 @@ public class KeycloakServerConfigBuilder {
return this.externalInfinispan;
}
public KeycloakServerConfigBuilder shutdownDelay(String shutdownDelay) {
this.shutdownDelay = shutdownDelay;
return this;
}
public KeycloakServerConfigBuilder shutdownTimeout(String shutdownTimeout) {
this.shutdownTimeout = shutdownTimeout;
return this;
}
/**
* Configure logging
*
@ -288,6 +300,10 @@ public class KeycloakServerConfigBuilder {
// Cache setup -> supported values: local or ispn
option("cache", cacheType.name().toLowerCase());
// Shutdown options - defaults optimised for test speed
option("shutdown-delay", shutdownDelay);
option("shutdown-timeout", shutdownTimeout);
log.build();
List<String> args = new LinkedList<>();

View file

@ -172,10 +172,12 @@ public abstract class AbstractQuarkusDeployableContainer implements DeployableCo
commands.add("--http-relative-path=/auth");
commands.add("--health-enabled=true"); // expose something to management interface to turn it on
if (suiteContext.get().isAuthServerMigrationEnabled()) {
commands.add("--hostname-strict=false");
} else { // Do not set management port for older versions of Keycloak for migration tests - available since Keycloak 25
commands.add("--http-management-port=" + configuration.getManagementPort());
commands.add("--shutdown-delay=0");
}
if (suiteContext.get().getMigrationContext().isRunningMigrationTest()) {