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

Mongodb connection string argument not passed when starting native integration tests #27075

Closed
nicolas-vivot opened this issue Aug 2, 2022 · 6 comments · Fixed by #27082
Closed
Assignees
Labels
Milestone

Comments

@nicolas-vivot
Copy link

nicolas-vivot commented Aug 2, 2022

Describe the bug

I recently tried to upgrade from Quarkus 2.7.6 to 2.11.1 and found some issues when running integration tests for a native build with maven, using mvn clean verify -Pnative.

The issue is the mongodb driver not being able to connect to the server, timing out when some of the integration test try to access the database.

To be more specific, this is only happening when performing a second group of tests using a different profile.
As you know, tests (native or not) using different profiles are grouped per profile in order to optimize the number of time the application / quarkus is rebooted to execute all tests.

The first set of integration test is working fine, the following command is run to start the application, right after popping the mongodb container:

Executing "/my-service-runner -Dquarkus.http.port=8081 -Dquarkus.http.ssl-port=8444 -Dtest.url=http://localhost:8081 -Dquarkus.log.file.path=/path/to/my/service/target/quarkus.log -Dquarkus.log.file.enable=true -Dquarkus.mongodb.connection-string=mongodb://localhost:49291/databasename"

with the port number being randomized.

But when the application is shutdown and restarted with a new fresh mongodb container, the command ommit the quarkus.mongodb.connection-string argument: (and adding a few ones i have no idea what for)

Executing "my-service-runner -Dquarkus.http.port=8081 -Dquarkus.http.ssl-port=8444 -Dtest.url=http://localhost:8081 -Dquarkus.log.file.path=/path/to/the/service/target/quarkus.log -Dquarkus.log.file.enable=true -Dquarkus.configuration.build-time-mismatch-at-runtime=fail -Dtoken.generator.secret=test -Dquarkus.profile=int-test -Dtoken.generator.issuer=integration-tests -Dtoken.generator.validity-delay=5"

The consequence is the service timing out on the tentative to connect to the mongodb server, as it tries by default to connect on the default mongodb port 127.0.0.1:27017 which surely cannot match the auto randomized port used by the dev services.

Failing since Quarkus 2.10.0 ?

After checking each version upgrade, i could finally spot the culprit version of Quarkus, the 2.10.0 (was still working fine on the 2.9.2, no matter wich jdk / graalvm or mandrel distribution is used)

I found the following ticket fixing something related to connection string / context information for the mongodb-client integrated into the 2.10.0-RC build and thus in the 2.10.0-Final release of Quarkus, could it be somehow related ?

Expected behavior

The native integration tests using multiple profiles should not fail for connectivity reasons.

Actual behavior

Since the mongo connection string is not passed anymore from the second boot / second profile, all tests needing a connection to the mongodb are failling.

How to Reproduce?

You should be able to reproduce it by using this reproducer

Requirements & how to reproduce in the readme.

@nicolas-vivot nicolas-vivot added the kind/bug Something isn't working label Aug 2, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Aug 2, 2022

@geoand
Copy link
Contributor

geoand commented Aug 2, 2022

Would you be able to supply a reproducer project?

Thanks

@geoand geoand added triage/needs-reproducer We are waiting for a reproducer. area/testing and removed area/mandrel labels Aug 2, 2022
@nicolas-vivot
Copy link
Author

nicolas-vivot commented Aug 2, 2022

@geoand

Added to the How to Reproduce section

@geoand geoand removed the triage/needs-reproducer We are waiting for a reproducer. label Aug 2, 2022
@geoand geoand self-assigned this Aug 2, 2022
geoand added a commit to geoand/quarkus that referenced this issue Aug 2, 2022
…TestExtension

This is needed to ensure the subsequent tests that need to relaunch dev-services
because of the use a different test profile

Fixes: quarkusio#27075
@geoand
Copy link
Contributor

geoand commented Aug 2, 2022

Thanks for the reproducer. #27082 takes care of the issue

geoand added a commit that referenced this issue Aug 2, 2022
Ensure that dev services properties are cleared in QuarkusIntegrationTestExtension
@quarkus-bot quarkus-bot bot added this to the 2.12 - main milestone Aug 2, 2022
@nicolas-vivot
Copy link
Author

nicolas-vivot commented Aug 3, 2022

@geoand By the way, will that fix be backported into a 2.11.2 / 2.10.5 ?

@geoand
Copy link
Contributor

geoand commented Aug 3, 2022

That's the plan

@gsmet gsmet modified the milestones: 2.12 - main, 2.11.2.Final Aug 3, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Aug 3, 2022
…TestExtension

This is needed to ensure the subsequent tests that need to relaunch dev-services
because of the use a different test profile

Fixes: quarkusio#27075
(cherry picked from commit a6a2c5d)
miador pushed a commit to miador/quarkus that referenced this issue Sep 6, 2022
…TestExtension

This is needed to ensure the subsequent tests that need to relaunch dev-services
because of the use a different test profile

Fixes: quarkusio#27075
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants