quarkusio / quarkus

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

dev-services ignore disabling #25307

Closed sorin-costea closed 2 years ago

sorin-costea commented 2 years ago

Describe the bug

quarkus.devservices.enabled=false in src/main/resources/application.properties I start a mvn test and get this log:

[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running test.qtest.AppTest
2022-05-02 19:36:58,948 INFO  [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final
2022-05-02 19:37:05,982 INFO  [io.qua.ama.lam.run.MockEventServer] (build-20) Mock Lambda Event Server Started
2022-05-02 19:37:07,071 INFO  [io.qua.ama.lam.run.AbstractLambdaPollLoop] (Lambda Thread (TEST)) Listening on: http://localhost:8081/_lambda_/2018-06-01/runtime/invocation/next
2022-05-02 19:37:07,093 INFO  [io.quarkus] (main) Quarkus 2.8.0.Final on JVM started in 9.008s. 
2022-05-02 19:37:07,094 INFO  [io.quarkus] (main) Profile test activated. 
2022-05-02 19:37:07,094 INFO  [io.quarkus] (main) Installed features: [amazon-lambda, cdi]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.441 s - in test.qtest.AppTest
2022-05-02 19:37:07,175 WARN  [io.qua.ama.lam.run.AbstractLambdaPollLoop] (Lambda Thread (TEST)) Aborting lambda poll loop: ending dev/test mode
2022-05-02 19:37:07,176 INFO  [io.qua.ama.lam.run.AbstractLambdaPollLoop] (Lambda Thread (TEST)) Lambda polling thread complete (TEST)
2022-05-02 19:37:07,212 INFO  [io.quarkus] (main) Quarkus stopped in 0.039s

Expected behavior

I didn't expect to have a Lambda mock started as the mocks were supposedly disabled.

Actual behavior

No response

How to Reproduce?

Reproducer here: https://github.com/sorin-costea/qtest Run it as you wish, from maven or from an IDE, same results.

Output of uname -a or ver

Microsoft Windows [Version 10.0.19044.1645]

Output of java -version

openjdk version "11.0.10" 2021-01-19 LTS OpenJDK Runtime Environment Corretto-11.0.10.9.1 (build 11.0.10+9-LTS) OpenJDK 64-Bit Server VM Corretto-11.0.10.9.1 (build 11.0.10+9-LTS, mixed mode)

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)

No response

Additional information

Also the log output is weird but that's another story...

quarkus-bot[bot] commented 2 years ago

/cc @stuartwdouglas

gsmet commented 2 years ago

I think the mock server for Lambda is different from devservices. That's why disabling dev services doesn't change a thing for you.

sorin-costea commented 2 years ago

The class starting the mock server is called "DevServicesLambdaProcessor.java" so it sounds like a devservice. But anyway, that class doesn't seem to care about any setting, it will start the mock server every time. I guess it's by design so, even though I can't see the reason for that. Also by design it uses the same default port as Quarkus dev itself 8081 so it will clash by design (luckily at least you can change that port after you get the first errors). Maybe @stuartwdouglas can enlighten us, as the bot suggested? :) Thank you!

stuartwdouglas commented 2 years ago

cc @patriot1burke

What is your use case for having both lambda and the normal Quarkus HTTP stack? In general they are mutually exclusive. If you are trying to handle HTTP requests in lambda it is not a normal HTTP request flow, the mock server lets you use a browser or other HTTP based tool (such as Restassured in tests) to test Lambda using normal HTTP (by basically acting like the lambda runtime).

patriot1burke commented 2 years ago

@stuartwdouglas DevServicesLambdaProcessor does not check quarkus.devservices.enabled=false

I need to add: @BuildStep(onlyIf = GlobalDevServicesConfig.Enabled.class)

sorin-costea commented 2 years ago

@stuartwdouglas I get this during the unit tests, where I don't need the lambda mock (nor http requests, actually). Maybe I think differently about what is "unit tests"?

sorin-costea commented 2 years ago

@stuartwdouglas DevServicesLambdaProcessor does not check quarkus.devservices.enabled=false

I need to add: @BuildStep(onlyIf = GlobalDevServicesConfig.Enabled.class)

@stuartwdouglas Any plan to add this at some point?