Skip to content

Commit

Permalink
Merge pull request #20797 from gsmet/close-delayed-handler
Browse files Browse the repository at this point in the history
Close the delayed log handler if exception
  • Loading branch information
gsmet authored Dec 23, 2021
2 parents 58cf76b + 794c71b commit f133a1b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.junit.jupiter.api.extension.TestInstancePostProcessor;
import org.opentest4j.TestAbortedException;

import io.quarkus.bootstrap.logging.InitialConfigurator;
import io.quarkus.runtime.test.TestHttpEndpointProvider;
import io.quarkus.test.common.ArtifactLauncher;
import io.quarkus.test.common.DevServicesContext;
Expand Down Expand Up @@ -205,6 +206,9 @@ public void close() throws Throwable {

return state;
} catch (Throwable e) {
if (!InitialConfigurator.DELAYED_HANDLER.isActivated()) {
activateLogging();
}

try {
if (testResourceManager != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.quarkus.test.junit;

import static io.quarkus.test.junit.IntegrationTestUtil.activateLogging;
import static io.quarkus.test.junit.IntegrationTestUtil.getAdditionalTestResources;

import java.io.Closeable;
Expand All @@ -21,6 +22,7 @@
import org.junit.jupiter.api.extension.ParameterResolver;

import io.quarkus.bootstrap.app.StartupAction;
import io.quarkus.bootstrap.logging.InitialConfigurator;
import io.quarkus.deployment.dev.testing.LogCapturingOutputFilter;
import io.quarkus.dev.console.QuarkusConsole;
import io.quarkus.dev.testing.TracingHandler;
Expand All @@ -36,8 +38,6 @@ public class QuarkusMainTestExtension extends AbstractJvmQuarkusTestExtension
public static final ExtensionContext.Namespace NAMESPACE = ExtensionContext.Namespace
.create("io.quarkus.test.main.jvm");

private static Map<String, String> devServicesProps;

PrepareResult prepareResult;
private static boolean hasPerTestResources;

Expand Down Expand Up @@ -159,6 +159,9 @@ private int doJavaStart(ExtensionContext context, Class<? extends QuarkusTestPro

return startupAction.runMainClassBlocking(arguments);
} catch (Throwable e) {
if (!InitialConfigurator.DELAYED_HANDLER.isActivated()) {
activateLogging();
}

try {
if (testResourceManager != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.quarkus.test.junit;

import static io.quarkus.test.junit.IntegrationTestUtil.activateLogging;
import static io.quarkus.test.junit.IntegrationTestUtil.getAdditionalTestResources;

import java.io.Closeable;
Expand Down Expand Up @@ -68,6 +69,7 @@
import io.quarkus.bootstrap.app.StartupAction;
import io.quarkus.bootstrap.classloading.ClassPathElement;
import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
import io.quarkus.bootstrap.logging.InitialConfigurator;
import io.quarkus.builder.BuildChainBuilder;
import io.quarkus.builder.BuildContext;
import io.quarkus.builder.BuildStep;
Expand Down Expand Up @@ -305,6 +307,9 @@ public void close() throws IOException {
ExtensionState state = new ExtensionState(testResourceManager, shutdownTask);
return state;
} catch (Throwable e) {
if (!InitialConfigurator.DELAYED_HANDLER.isActivated()) {
activateLogging();
}

try {
if (testResourceManager != null) {
Expand Down

0 comments on commit f133a1b

Please sign in to comment.