fix: increases another timeout to accomodate for the transaction timeout (#26566)

closes: #26529

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
Steven Hawkins 2024-01-30 03:16:34 -05:00 committed by GitHub
parent 7e021730c7
commit 00ea73d6ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View file

@ -77,8 +77,8 @@ public class FipsDistTest {
runOnFipsEnabledDistribution(dist, () -> {
dist.copyOrReplaceFileFromClasspath("/server.keystore", Path.of("conf", "server.keystore"));
CLIResult cliResult = dist.run("start", "--fips-mode=strict");
cliResult.assertMessage("ERROR: java.lang.IllegalArgumentException: malformed sequence");
dist.assertStopped();
cliResult.assertMessage("ERROR: java.lang.IllegalArgumentException: malformed sequence");
});
}
@ -125,8 +125,8 @@ public class FipsDistTest {
runOnFipsEnabledDistribution(dist, () -> {
dist.copyOrReplaceFileFromClasspath("/server.keystore.pkcs12", Path.of("conf", "server.keystore"));
CLIResult cliResult = dist.run("start", "--fips-mode=strict", "--https-key-store-password=passwordpassword");
cliResult.assertMessage("ERROR: java.lang.IllegalArgumentException: malformed sequence");
dist.assertStopped();
cliResult.assertMessage("ERROR: java.lang.IllegalArgumentException: malformed sequence");
});
}

View file

@ -79,6 +79,10 @@ import static org.keycloak.quarkus.runtime.Environment.isWindows;
public final class RawKeycloakDistribution implements KeycloakDistribution {
// TODO: reconsider the hardcoded timeout once https://issues.redhat.com/browse/JBTM-3830 is pulled into Keycloak
// ensures that the total wait time (two minutes for readiness + 200 seconds) is longer than the transaction timeout of 5 minutes
private static final int LONG_SHUTDOWN_WAIT = 200;
private static final int DEFAULT_SHUTDOWN_TIMEOUT_SECONDS = 10;
private static final Logger LOG = Logger.getLogger(RawKeycloakDistribution.class);
@ -162,8 +166,7 @@ public final class RawKeycloakDistribution implements KeycloakDistribution {
destroyDescendantsOnWindows(keycloak, false);
keycloak.destroy();
// TODO: reconsider the hardcoded timeout once https://issues.redhat.com/browse/JBTM-3830 is pulled into Keycloak
keycloak.waitFor(180, TimeUnit.SECONDS);
keycloak.waitFor(LONG_SHUTDOWN_WAIT, TimeUnit.SECONDS);
exitCode = keycloak.exitValue();
} catch (Exception cause) {
destroyDescendantsOnWindows(keycloak, true);
@ -263,7 +266,7 @@ public final class RawKeycloakDistribution implements KeycloakDistribution {
public void assertStopped() {
try {
if (keycloak != null) {
keycloak.onExit().get(1, TimeUnit.MINUTES);
keycloak.onExit().get(LONG_SHUTDOWN_WAIT, TimeUnit.SECONDS);
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
@ -271,7 +274,7 @@ public final class RawKeycloakDistribution implements KeycloakDistribution {
} catch (ExecutionException e) {
throw new RuntimeException(e);
} catch (TimeoutException e) {
LOG.warn("Process did not exit within a minute as expected, will attempt a thread dump");
LOG.warn("Process did not exit as expected, will attempt a thread dump");
threadDump();
LOG.warn("TODO: this should be a hard error / re-diagnosed after https://issues.redhat.com/browse/JBTM-3830 is pulled into Keycloak");
}