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

[SUREFIRE-1659] Log4j logger in TestExecutionListener corrupts Surefire's STDOUT #342

Merged
merged 1 commit into from
Mar 31, 2021

Conversation

kalgon
Copy link
Contributor

@kalgon kalgon commented Mar 26, 2021

Fix candidate for SUREFIRE-1659

@kalgon kalgon changed the title Fix for SUREFIRE-1659 [SUREFIRE-1659] Log4j logger in TestExecutionListener corrupts Surefire's STDOUT Mar 27, 2021
import org.junit.platform.launcher.TestPlan;
import org.junit.platform.launcher.core.LauncherFactory;

class LazyLauncher implements Launcher
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls put a Javadoc for the class with the purpose of the class.

@Tibor17
Copy link
Contributor

Tibor17 commented Mar 28, 2021

@kalgon Can you extend the integration test JUnitPlatformStreamCorruptionIT? Its purpose is to assert that the console logs do not contain the message Corrupted channel by directly writing to native stream in forked JVM. The POM and project which is tested by this IT appears in surefire-its/src/test/resources/surefire-1614-stream-corruption. All you need to do is to add a new maven profile in the pom.xml and the motivation can be found in the comment where you can see the zip file src.zip.

@kalgon
Copy link
Contributor Author

kalgon commented Mar 29, 2021

@Tibor17 Thanks for the feedback and for pointing me how to test the fix (I really had no idea how to test that). I'll take a look at it.

@@ -49,12 +49,42 @@ public void warningIsNotEmitted() throws VerificationException
{
OutputValidator validator = unpack( "/surefire-1614-stream-corruption" )
.executeTest()
.verifyErrorFree( 1 );
.verifyErrorFree( 2 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you change the project within surefire-1614-stream-corruption? I do not understand why 2 tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, this line should not have changed. I first tried to add a new test in surefire-1614-stream-corruption (that's where the 2 comes from) but in the end, I created a new mini-project in surefire-1659-stream-corruption because the easiest way to trigger the problem is to have a junit-platform.properties and a redirection from java.util.logging to any other logging framework (I tested with both log4j and slf4j/logback). I'll change that 2 back to 1 ASAP. Do you have any other remark?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for making it clear. Yes there are some little changes only.


<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please turn 1.8 to ${java.specification.version}.

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.7.0</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 5.7.0 mandatory?
Can we use 5.7.1?

@Tibor17
Copy link
Contributor

Tibor17 commented Mar 29, 2021

Finally, squash the commits and rename the final commit to the name of PR.

@Tibor17
Copy link
Contributor

Tibor17 commented Mar 31, 2021

@kalgon
Thx for contributing! I am going to publish pull requests where I need to have clever participants. Feel free to track the pull requests in the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants