-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
DevServices config not making it to quarkusIntTest config #25730
Comments
/cc @stuartwdouglas |
I understand why one would think this could work, but unfortunately it does not because QuarkusIntegrationTest works fundamentally differently than QuarkusTest. |
So is there no way to get the config from the running devmode containers? This feels like something that should exist for intTests... again the use case being playing with test data (and at the very least clearing the db between tests). I guess I will need to swap back to using manually created testcontainers as resources again |
The integration test does not have access to the same information the application under test does. It's meant to interact with it as a black box |
That makes sense, but testing sometimes needs interaction with the data that's stored to setup some specific state; and should definitely be available to reset that state between tests. I'm not against leaving the service being tested as a black box, but tests should have some access to the databases the service uses. |
I don't think it would be unreasonable to set/clear dev services config for each test. We already do this for resource manager properties here: https://github.com/stuartwdouglas/quarkus/blob/12e4c170bd48e61ce0e459f78a48203c0deeaeee/test-framework/junit5/src/main/java/io/quarkus/test/junit/NativeTestExtension.java#L138 We could just do the same thing for de services properties. |
It would be nice, I'm having the darndest time with this... Trying to setup test resources for the int test is a little different, as you can't tell the running container to just talk to localhost. Looks like the devservices use a unique hostname for each instance too, further complicating things. Would be nice to just have the devservices report back to the test code where to access its services |
This allows integration tests to access dev services config in the same way you would with a TestResourceManager. Fixes quarkusio#25730
Describe the bug
In some of my quarkusIntTest tests, I am attempting to connect to the Mongo devServices instance to play with test data and cleanup after each test.
These tests work fine in regular
@QuarkusTest
mode, however it seems that thequarkus.mongodb.connection-string
config value never makes it to the test context.I am attempting to get the value via
ConfigProvider.getConfig().getValue("quarkus.mongodb.connection-string", String.class);
.I have confirmed that the mongo service is running in docker at the time, and
quarkus.devservices.enabled=true
doesn't change anythingExpected behavior
I shold be able to use
ConfigProvider.getConfig().getValue("quarkus.mongodb.connection-string", String.class);
, and the connection string from the Mongo dev service is present.Actual behavior
The config value expected from the mongo dev service isn't present in
quarkusIntTest
test context.How to Reproduce?
I have a reproducer here:
https://github.com/Epic-Breakfast-Productions/OpenQuarterMaster/tree/main/software/plugins/open-qm-plugin-demo
Simply run the
quarkusIntTest
task on that project.You will have to run
publishToMavenLocal
on this project though, for a library dependency:https://github.com/Epic-Breakfast-Productions/OpenQuarterMaster/tree/main/software/libs/open-qm-core
Output of
uname -a
orver
Linux gen-dev-box 5.13.0-41-generic #46~20.04.1-Ubuntu SMP Wed Apr 20 13:16:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk 11.0.15 2022-04-19
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.9.1.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 7.3
Additional information
No response
The text was updated successfully, but these errors were encountered: