quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.73k stars 2.67k forks source link

QuarkusTest behaviour changed after 2.2.3->2.3 upgrade #25044

Closed sorin-costea closed 2 years ago

sorin-costea commented 2 years ago

Describe the bug

I couldn't see where this was documented (if it's by design) or reported (if it's a bug) but my @QuarkusTest JUnit5 AWS Lambda tests now try to start a Lambda mock server and fails.

Before, it was running tests perfectly as local JAR. The only change I did was bumping the Quarkus bom version from 2.2.3 to 2.3.0.Final. I tried also 2.8.0.Final and same issue: unit tests fail - because it tries to start the Lambda mock server on the already used Quarkus test port 8081. Of course, if I change the quarkus.lambda.mock-event-server.dev-port/test-port it works, but why do I need it newly?

The documentation "testing your application" page describes only what to test, but not how to switch between testing types, and the Quarkus Lambda only mentions that it always starts a mock server - which I don't even need (no integration tests, no containers, just unit testing the functions logic). I checked also the 2.2 documentation pages version, same.

Did some default change? And if yes, how can I run the tests like before, as local jars by default? And why does the Lambda mock server use the same port as Quarkus itself anyway?

Expected behavior

Unit tests are run in JVM mode, no extra components

Actual behavior

Unit tests start the integration test infrastructure, even without Failsafe being present in pom.

How to Reproduce?

No response

Output of uname -a or ver

Microsoft Windows [Version 10.0.19042.1645]

Output of java -version

correto-jdk11.0.10_9

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.8.0.Final

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

Eclipse/maven

Additional information

I used to run the Unit tests directly from Eclipse with a rightclick.

sorin-costea commented 2 years ago

Oh and now that I upgraded to 2.8 I notice also Testcontainers trying things and failing. How can I skip all those errors, as I have no need for them?

2022-04-20 18:35:00,127 WARN  [org.tes.uti.TestcontainersConfiguration] (build-20) Attempted to read Testcontainers configuration file at file:/C:/Users/myuser/.testcontainers.properties but the file was not found. Exception message: FileNotFoundException: C:\Users\myuser\.testcontainers.properties (The system cannot find the file specified)
2022-04-20 18:35:06,715 INFO  [org.tes.doc.DockerMachineClientProviderStrategy] (build-20) docker-machine executable was not found on PATH ([...])
2022-04-20 18:35:06,717 ERROR [org.tes.doc.DockerClientProviderStrategy] (build-20) Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
2022-04-20 18:35:06,718 ERROR [org.tes.doc.DockerClientProviderStrategy] (build-20)     NpipeSocketClientProviderStrategy: failed with exception TimeoutException (org.rnorth.ducttape.TimeoutException: java.util.concurrent.TimeoutException). Root cause TimeoutException (null)
2022-04-20 18:35:06,718 ERROR [org.tes.doc.DockerClientProviderStrategy] (build-20) As no valid configuration was found, execution cannot continue
2022-04-20 18:35:08,571 INFO  [io.qua.ama.lam.run.MockEventServer] (build-4) Mock Lambda Event Server Started
2022-04-20 18:35:28,188 WARN  [io.qua.ela.res.com.dep.DevServicesElasticsearchProcessor] (build-20) Docker isn't working, please configure the Elasticsearch hosts property (quarkus.elasticsearch.hosts).
2022-04-20 18:35:36,552 INFO  [io.qua.ama.lam.run.AbstractLambdaPollLoop] (Lambda Thread (TEST)) Listening on: http://localhost:8082/_lambda_/2018-06-01/runtime/invocation/next
2022-04-20 18:35:36,623 INFO  [io.quarkus] (main) Quarkus 2.8.0.Final on JVM started in 42.160s. Listening on: http://localhost:8081
2022-04-20 18:35:36,624 INFO  [io.quarkus] (main) Profile test activated. 
2022-04-20 18:35:36,626 INFO  [io.quarkus] (main) Installed features: [amazon-lambda, cdi, elasticsearch-rest-client, elasticsearch-rest-high-level-client, resteasy-jackson, smallrye-context-propagation, smallrye-openapi, swagger-ui, vertx]
2022-04-20 18:35:39,143 INFO  [org.sor.lis.ApiTests] (main) getMainFunctionTest
gastaldi commented 2 years ago

You can add quarkus.devservices.enabled=false to your application.properties

sorin-costea commented 2 years ago

Thank you, that did it. Good to know!

gastaldi commented 2 years ago

For the record, this is documented here: https://quarkus.io/guides/dev-services

sorin-costea commented 2 years ago

It's just difficult to make the link between some sudden docker error messages and the dev-services :)