diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java index edc69c0805231..a3f00de8224aa 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java @@ -435,15 +435,7 @@ public void close() throws IOException { } finally { tcclMethodCache.clear(); GroovyCacheCleaner.clearGroovyCache(); - if (hangTaskKey != null) { - hangTaskKey.cancel(true); - hangTaskKey = null; - } - var h = hangDetectionExecutor; - if (h != null) { - h.shutdownNow(); - hangDetectionExecutor = null; - } + shutdownHangDetection(); } } try { @@ -472,6 +464,18 @@ public void close() throws IOException { } } + private void shutdownHangDetection() { + if (hangTaskKey != null) { + hangTaskKey.cancel(true); + hangTaskKey = null; + } + var h = hangDetectionExecutor; + if (h != null) { + h.shutdownNow(); + hangDetectionExecutor = null; + } + } + private void populateDeepCloneField(StartupAction startupAction) { deepClone = new SerializationWithXStreamFallbackDeepClone(startupAction.getClassLoader()); } @@ -1333,6 +1337,7 @@ class FailedCleanup implements ExtensionContext.Store.CloseableResource { @Override public void close() { + resetHangTimeout(); firstException = null; failedBoot = false; ConfigProviderResolver.setInstance(null);