Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable logging from integration tests #20356

Merged
merged 1 commit into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import io.quarkus.bootstrap.utils.BuildToolHelper;
import io.quarkus.deployment.builditem.DevServicesLauncherConfigResultBuildItem;
import io.quarkus.runtime.configuration.ProfileManager;
import io.quarkus.runtime.logging.LoggingSetupRecorder;
import io.quarkus.test.common.ArtifactLauncher;
import io.quarkus.test.common.PathTestHelper;
import io.quarkus.test.common.TestClassIndexer;
Expand Down Expand Up @@ -296,6 +297,12 @@ public void accept(String s, String s2) {
return new DefaultDevServicesLaunchResult(propertyMap, networkId, curatedApplication);
}

static void activateLogging() {
geoand marked this conversation as resolved.
Show resolved Hide resolved
// calling this method of the Recorder essentially sets up logging and configures most things
// based on the provided configuration
LoggingSetupRecorder.handleFailedStart();
}

static class DefaultDevServicesLaunchResult implements ArtifactLauncher.InitContext.DevServicesLaunchResult {
private final Map<String, String> properties;
private final String networkId;
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.*;
import static io.quarkus.test.junit.IntegrationTestUtil.determineBuildOutputDirectory;
import static io.quarkus.test.junit.IntegrationTestUtil.determineTestProfileAndProperties;
import static io.quarkus.test.junit.IntegrationTestUtil.doProcessTestInstance;
Expand Down Expand Up @@ -84,7 +85,7 @@ private IntegrationTestExtensionState ensureStarted(ExtensionContext extensionCo
ExtensionContext.Store store = root.getStore(ExtensionContext.Namespace.GLOBAL);
IntegrationTestExtensionState state = store.get(IntegrationTestExtensionState.class.getName(),
IntegrationTestExtensionState.class);
Class<? extends QuarkusTestProfile> selectedProfile = IntegrationTestUtil.findProfile(testClass);
Class<? extends QuarkusTestProfile> selectedProfile = findProfile(testClass);
boolean wrongProfile = !Objects.equals(selectedProfile, quarkusTestProfile);
// we reload the test resources if we changed test class and if we had or will have per-test test resources
boolean reloadTestResources = !Objects.equals(extensionContext.getRequiredTestClass(), currentJUnitTestClass)
Expand Down Expand Up @@ -184,6 +185,7 @@ public void close() throws Throwable {
"Artifact type + '" + artifactType + "' is not supported by @QuarkusIntegrationTest");
}

activateLogging();
startLauncher(launcher, additionalProperties, () -> ssl = true);

IntegrationTestExtensionState state = new IntegrationTestExtensionState(testResourceManager, launcher,
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.determineBuildOutputDirectory;
import static io.quarkus.test.junit.IntegrationTestUtil.determineTestProfileAndProperties;
import static io.quarkus.test.junit.IntegrationTestUtil.getAdditionalTestResources;
Expand Down Expand Up @@ -148,6 +149,7 @@ private ArtifactLauncher.LaunchResult doProcessStart(ExtensionContext context, S
}

launcher.includeAsSysProps(additionalProperties);
activateLogging();
return launcher.runToCompletion(args);

} finally {
Expand Down