From 00ea73d6ba266c7a01ad3b06589aae123488798b Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Tue, 30 Jan 2024 03:16:34 -0500 Subject: [PATCH] fix: increases another timeout to accomodate for the transaction timeout (#26566) closes: #26529 Signed-off-by: Steve Hawkins --- .../java/org/keycloak/it/cli/dist/FipsDistTest.java | 4 ++-- .../keycloak/it/utils/RawKeycloakDistribution.java | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/FipsDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/FipsDistTest.java index 26f4df47c0..2faf8e184a 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/FipsDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/FipsDistTest.java @@ -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"); }); } diff --git a/quarkus/tests/junit5/src/main/java/org/keycloak/it/utils/RawKeycloakDistribution.java b/quarkus/tests/junit5/src/main/java/org/keycloak/it/utils/RawKeycloakDistribution.java index f36fc46790..5ed1160a9b 100644 --- a/quarkus/tests/junit5/src/main/java/org/keycloak/it/utils/RawKeycloakDistribution.java +++ b/quarkus/tests/junit5/src/main/java/org/keycloak/it/utils/RawKeycloakDistribution.java @@ -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"); }