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

Live reload is not working for tests #43432

Open
rcsim opened this issue Sep 22, 2024 · 7 comments
Open

Live reload is not working for tests #43432

rcsim opened this issue Sep 22, 2024 · 7 comments
Labels

Comments

@rcsim
Copy link

rcsim commented Sep 22, 2024

Describe the bug

During a workshop using the https://quarkus.io/quarkus-workshops/super-heroes/ , I followed the steps but got an error when I changed the Endpoint Resource and Test and ran the tests without re-launching the application.

Expected behavior

As per the Live Reload feature, after changing the test files to match the resource file, tests would pass without the need to relaunch the application.

Actual behavior

It is needed to fully relaunch the application to the test pass.

How to Reproduce?

Steps:
1- Create the rest-villains REST project.
2- Run the project in dev mode (./mvnw quarkus:dev).
3- Verify Endpoit is returning the String "Hello from Quarkus REST".
4- Change the String at VillainResource to "Hello Villain Resource"
5- Verify Endpoit returns the String "Hello from Quarkus REST" without relaunching the application.
6- Run the tests using "r" in develop mode, testing is failing as expected.
7- Change the String at VillainResourceTest.
8- Run the tests again using "r" in develop mode, testing is failing but this time it is expected to pass and the Strings at VillainResource and VillainResourceTest match.

How to recover:
1- Relaunch the application ( stop and run ./mvnw quarkus:dev), now the test passes.

Output of uname -a or ver

Linux rcsim-p52 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 GNU/Linux

Output of java -version

java version "17.0.12" 2024-07-16 LTS Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286) Java HotSpot(TM) 64-Bit Server VM (build 17.0.12+8-LTS-286, mixed mode, sharing)

Quarkus version or git rev

(Quarkus Main Thread) rest-villains 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.15.0)

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

Maven home: /home/rcsim/Workspace/tools/maven/apache-maven-3.9.6 Java version: 17.0.12, vendor: Oracle Corporation, runtime: /mnt/c/Users/rcsim/Workspace/tools/jdk/jdk-17.0.12 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.15.153.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"

Additional information

Logs from the terminal:

`2024-09-22 10:46:33,296 ERROR [io.qua.test] (Test runner thread) ==================== TEST REPORT #3 ====================
2024-09-22 10:46:33,297 ERROR [io.qua.test] (Test runner thread) Test VillainResourceTest#testHelloEndpoint() failed
: java.lang.AssertionError: 1 expectation failed.
Response body doesn't match expectation.
Expected: is "Hello from Quarkus REST"
Actual: Hello Villain Resource

    at io.restassured.internal.ValidatableResponseOptionsImpl.body(ValidatableResponseOptionsImpl.java:238)
    at io.quarkus.workshop.superheroes.villain.VillainResourceTest.testHelloEndpoint(VillainResourceTest.java:17)

2024-09-22 10:46:33,297 ERROR [io.qua.test] (Test runner thread) >>>>>>>>>>>>>>>>>>>> Summary: <<<<<<<<<<<<<<<<<<<<
io.quarkus.workshop.superheroes.villain.VillainResourceTest#testHelloEndpoint(VillainResourceTest.java:17) VillainResourceTest#testHelloEndpoint() 1 expectation failed.
Response body doesn't match expectation.
Expected: is "Hello from Quarkus REST"
Actual: Hello Villain Resource
2024-09-22 10:46:33,298 ERROR [io.qua.test] (Test runner thread) >>>>>>>>>>>>>>>>>>>> 1 TEST FAILED <<<<<<<<<<<<<<<<<<<<`

Force Restart and test again (Still Failing):
`2024-09-22 10:59:57,307 INFO [io.qua.dep.dev.RuntimeUpdatesProcessor] (Aesh InputStream Reader) Restarting as requested by the user.

2024-09-22 10:59:57,318 INFO [io.quarkus] (Quarkus Main Thread) rest-villains stopped in 0.010s


--/ __ / / / / _ | / _ / /// / / / __/
-/ /
/ / // / __ |/ , / ,< / // /\
--___
// |//|//||_//
2024-09-22 10:59:57,746 INFO [io.quarkus] (Quarkus Main Thread) rest-villains 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.15.0) started in 0.423s. Listening on: http://localhost:8080

2024-09-22 10:59:57,747 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.

2024-09-22 10:59:57,748 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, rest, rest-jackson, smallrye-context-propagation, vertx]

2024-09-22 10:59:57,749 INFO [io.qua.dep.dev.RuntimeUpdatesProcessor] (Aesh InputStream Reader) Live reload total time: 0.502s

2024-09-22 11:00:03,211 ERROR [io.qua.test] (Test runner thread) ==================== TEST REPORT #4 ====================
2024-09-22 11:00:03,212 ERROR [io.qua.test] (Test runner thread) Test VillainResourceTest#testHelloEndpoint() failed
: java.lang.AssertionError: 1 expectation failed.
Response body doesn't match expectation.
Expected: is "Hello from Quarkus REST"
Actual: Hello Villain Resource

    at io.restassured.internal.ValidatableResponseOptionsImpl.body(ValidatableResponseOptionsImpl.java:238)
    at io.quarkus.workshop.superheroes.villain.VillainResourceTest.testHelloEndpoint(VillainResourceTest.java:17)

2024-09-22 11:00:03,212 ERROR [io.qua.test] (Test runner thread) >>>>>>>>>>>>>>>>>>>> Summary: <<<<<<<<<<<<<<<<<<<<
io.quarkus.workshop.superheroes.villain.VillainResourceTest#testHelloEndpoint(VillainResourceTest.java:17) VillainResourceTest#testHelloEndpoint() 1 expectation failed.
Response body doesn't match expectation.
Expected: is "Hello from Quarkus REST"
Actual: Hello Villain Resource
2024-09-22 11:00:03,212 ERROR [io.qua.test] (Test runner thread) >>>>>>>>>>>>>>>>>>>> 1 TEST FAILED <<<<<<<<<<<<<<<<<<<<`

Stop and Run the application again:
`2024-09-22 11:07:26,931 INFO [io.quarkus] (Shutdown thread) rest-villains stopped in 0.002s

--
Press [e] to edit command line args (currently ''), [r] to resume testing, [o] Toggle test output, [:] for the terminal, [h] for more options>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23:54 min
[INFO] Finished at: 2024-09-22T11:07:27-03:00
[INFO] ------------------------------------------------------------------------
rcsim@rcsim-p52:~/Workspace/learning/quarkus/workshop/quarkus-super-heroes/super-heroes/rest-villains$ ./mvnw quarkus:dev
[INFO] Scanning for projects...
[INFO]
[INFO] -----------< io.quarkus.workshop.super-heroes:rest-villains >-----------
[INFO] Building rest-villains 1.0.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- quarkus:3.15.0:dev (default-cli) @ rest-villains ---
[INFO] Invoking resources:3.3.1:resources (default-resources) @ rest-villains
[INFO] Copying 1 resource from src/main/resources to target/classes
[INFO] Invoking quarkus:3.15.0:generate-code (default) @ rest-villains
[INFO] Invoking compiler:3.13.0:compile (default-compile) @ rest-villains
[INFO] Nothing to compile - all classes are up to date.
[INFO] Invoking resources:3.3.1:testResources (default-testResources) @ rest-villains
[INFO] skip non existing resourceDirectory /mnt/c/Users/rcsim/Workspace/learning/quarkus/workshop/quarkus-super-heroes/super-heroes/rest-villains/src/test/resources
[INFO] Invoking quarkus:3.15.0:generate-code-tests (default) @ rest-villains
[INFO] Invoking compiler:3.13.0:testCompile (default-testCompile) @ rest-villains
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 2 source files with javac [debug parameters release 17] to target/test-classes
Listening for transport dt_socket at address: 5005


--/ __ / / / / _ | / _ / /// / / / __/
-/ /
/ / // / __ |/ , / ,< / // /\
--___
// |//|//||_//
2024-09-22 11:07:46,023 INFO [io.quarkus] (Quarkus Main Thread) rest-villains 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.15.0) started in 2.419s. Listening on: http://localhost:8080

2024-09-22 11:07:46,026 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2024-09-22 11:07:46,026 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, rest, rest-jackson, smallrye-context-propagation, vertx]

--
All 1 test is passing (0 skipped), 1 test was run in 3029ms. Tests completed at 11:07:53.
Press [e] to edit command line args (currently ''), [r] to re-run, [o] Toggle test output, [:] for the terminal, [h] for more options>`

@quarkus-bot
Copy link

quarkus-bot bot commented Sep 23, 2024

/cc @stuartwdouglas (continuous-testing)

@nasonawa
Copy link

Hi @rcsim

I followed the steps outlined to reproduce the issue, but it seems to be working fine on my end. I’m not able to replicate the problem. Could anyone provide additional context or specific conditions under which the issue occurs? That might help narrow it down.

attaching the screen shot, in which the test are getting passed without restarting the quarkus in dev mode.

Screenshot from 2024-09-23 15-33-58

Regards,
Nayan

@rcsim
Copy link
Author

rcsim commented Sep 23, 2024

Hi @nasonawa ,

Thanks for trying to reproduce this issue. I'm glad that this may be a specific issue affecting users in some particular scenario and not involving all Quarkus developers.
I have double-checked and I'm still reproducing this issue, do you think it could be the version of Java or Manven installed on my machine?
I'm using a Windows 11 Machine with WSL, please see below my tools versions:

rcsim@rcsim-p52:~$ java -version
java version "17.0.12" 2024-07-16 LTS
Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.12+8-LTS-286, mixed mode, sharing)
rcsim@rcsim-p52:~$ $GRAALVM_HOME/bin/native-image --version
native-image 17.0.9 2023-10-17
GraalVM Runtime Environment GraalVM CE 17.0.9+9.1 (build 17.0.9+9-jvmci-23.0-b22)
Substrate VM GraalVM CE 17.0.9+9.1 (build 17.0.9+9, serial gc)
rcsim@rcsim-p52:~$ mvn --version
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /home/rcsim/Workspace/tools/maven/apache-maven-3.9.6
Java version: 17.0.12, vendor: Oracle Corporation, runtime: /mnt/c/Users/rcsim/Workspace/tools/jdk/jdk-17.0.12
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.15.153.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"
rcsim@rcsim-p52:~$ uname -a
Linux rcsim-p52 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 GNU/Linux

Thanks for the help
Rodrigo

@mcruzdev
Copy link
Contributor

I attempted to replicate this on my Windows machine using WSL 2, ensuring I used the same versions of Java, OS, and Maven, but unfortunately, I was not successful.

@rcsim
Copy link
Author

rcsim commented Oct 2, 2024

Hi @mcruzdev and @nasonawa,
I'm sorry for the delay, but today I finally got time to reproduce this issue again and I've recorded a video showing how I can reproduce this issue. Please check the video below (uploaded on YouTube as unlisted):

https://www.youtube.com/watch?v=EFACOoaY8OI

Please, any questions just let me know.

Thanks for your support.

Best regards,
Rodrigo

@gastaldi
Copy link
Contributor

gastaldi commented Oct 2, 2024

@geoand any idea what may cause this?

@geoand
Copy link
Contributor

geoand commented Oct 2, 2024

Not off the top of my head

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

5 participants