From ebddbc3bc1d22753c23d198ed7d8df0ffa6315ab Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Thu, 2 Sep 2021 10:51:13 +1000 Subject: [PATCH] Clean up hang detection on failed start This can cause a false positive in the vertx-http-deployment tests where a continuous test fails to start, then spits out a hang detection warning a minute later. --- .../test/junit/QuarkusTestExtension.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) 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);