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

LaunchResult#getOutput() behaves differently in continuous testing mode than with ./mvnw clean verify #22790

Closed
cdhermann opened this issue Jan 11, 2022 · 2 comments
Labels
Milestone

Comments

@cdhermann
Copy link
Contributor

Describe the bug

Using LaunchResult#getOutput() in a @QuarkusMainTest in quarkus dev continuous testing mode, it captures no only the output of the CLI application. In addition, the dev mode output on stdout is also captured. This causes tests to fail in quarkus dev mode. The tests work flawlessly when run with ./mvnw clean verify

Expected behavior

LaunchResult#getOutput() captures only stdout and stderr of the CLI application and disregards the stdout output of quarkus dev

Actual behavior

Actually, LaunchResult#getOutput() captures also the stdout of quarkus dev in continuous testing mode.

How to Reproduce?

  1. Download repository at tag QuarkusMainTestDifferentOutputCapture
  2. Run quarkus dev
  3. You will see the test GreetingCommandTest#testGreet(QuarkusMainLauncher) fail with
    org.opentest4j.AssertionFailedError: expected: <Hello Demo, go go commando> but was: <2022-01-11 
    09:38:02,301 INFO  [io.quarkus] (Test runner thread) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by 
    Quarkus 2.6.2.Final) started in 0.343s. 
    2022-01-11 09:38:02,302 INFO  [io.quarkus] (Test runner thread) Profile test activated. 
    2022-01-11 09:38:02,302 INFO  [io.quarkus] (Test runner thread) Installed features: [cdi, picocli]
    Hello Demo, go go commando
    2022-01-11 09:38:02,328 INFO  [io.quarkus] (Test runner thread) code-with-quarkus(test application) stopped in 
    0.001s>
            at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
            at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
            at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
            at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
            at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141)
            at org.acme.GreetingCommandTest.testGreet(GreetingCommandTest.java:14)
    
  4. Exit quarkus dev
  5. Run ./mvnw clean verify and all tests will pass

Output of uname -a or ver

Darwin cdh 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:29:10 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T8101 arm64

Output of java -version

java version "17" 2021-09-14 LTS Java(TM) SE Runtime Environment (build 17+35-LTS-2724) Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.6.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: ~/.m2/wrapper/dists/apache-maven-3.8.1-bin/2l5mhf2pq2clrde7f7qp1rdt5m/apache-maven-3.8.1 Java version: 17, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home Default locale: de_AT, platform encoding: UTF-8 OS name: "mac os x", version: "12.1", arch: "aarch64", family: "mac"

Additional information

No response

@cdhermann cdhermann added the kind/bug Something isn't working label Jan 11, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Jan 11, 2022

/cc @stuartwdouglas

@stuartwdouglas
Copy link
Member

This has been fixed upstream in that both of them now capture the full output. If you only want the STDOUT bit then you need to set the log level to WARN to that INFO logs are not printed.

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

No branches or pull requests

3 participants