Closed tmohme closed 3 years ago
@stuartwdouglas I assume this was not intentional, right?
The linked PR should fix it, but note that you will explicitly have to disable Dev Services (quarkus.devservices.enabled=false
) otherwise you will get two datasources. This is due to a mismatch in the lifecycle of dev services and QuarkusTestResource that we can't really do much about (in general we recommend dev services instead of QuarkusTestResource).
Describe the bug
I'm trying to test a CLI app together with a database. For this, I created a simple test in a class annotated with
QuarkusMainTest
and alsoQuarkusTestResource
. Unfortunately, in this combination the specifiedQuarkusTestResource
is ignored.Expected behavior
The
QuarkusTestResource
annotation should be respected. Interestingly, when usingQuarkusTest
instead ofQuarkusMainTest
, the testQuarkusTestResource
is respected.Actual behavior
The
QuarkusTestResource
annotation is ignored. Somehow, Quarkus figures out a PostgreSQL database is required and starts a Testcontainer with a PostgreSQL DB, but it is not the one specified/configured by the resource class!How to Reproduce?
unpack reproducer.zip
run
./mvnw clean test
=> The text "***starting***}" does not appear in the test-log. => Also, you will see in the log that postgres:13.2 gets started.Replace the
QuarkusMainTest
annotation withQuarkusTest
and run the test again.=> The text "***starting***" does appear in the test-log. => Also, you will see in the log that postgres:14 gets started.
Output of
uname -a
orver
Darwin My-iMac.local 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64
Output of
java -version
openjdk version "11.0.11" 2021-04-20 LTS OpenJDK Runtime Environment Zulu11.48+21-CA (build 11.0.11+9-LTS) OpenJDK 64-Bit Server VM Zulu11.48+21-CA (build 11.0.11+9-LTS, mixed mode)
GraalVM version (if different from Java)
./.
Quarkus version or git rev
2.3.0.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Additional information
No response