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] devservice executed when host provided #40414

Closed
dcdh opened this issue May 2, 2024 · 5 comments · Fixed by #45330
Closed

[mongodb] devservice executed when host provided #40414

dcdh opened this issue May 2, 2024 · 5 comments · Fixed by #45330

Comments

@dcdh
Copy link
Contributor

dcdh commented May 2, 2024

Description

When the quarkus.mongodb.connection-string is provided the mongo devservice do not launch a container because the developer wants to use the mongo instance provided.

This behavior is defined here: https://github.com/quarkusio/quarkus/blob/main/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/DevServicesMongoProcessor.java#L150

When the quarkus.mongodb.hosts is used to define a connection instead of quarkus.mongodb.connection-string a mongo container is created and started by the devservice at startup. Is it possible to not start a container to use the hosts provided ?

Implementation ideas

Replace this:

boolean needToStart = !ConfigUtils.isPropertyPresent(configPrefix + "connection-string");

by

boolean needToStart = !ConfigUtils.isPropertyPresent(configPrefix + "connection-string") && !ConfigUtils.isPropertyPresent(configPrefix + "hosts");
@dcdh dcdh added the kind/enhancement New feature or request label May 2, 2024
Copy link

quarkus-bot bot commented May 2, 2024

/cc @geoand (devservices), @loicmathieu (mongodb), @stuartwdouglas (devservices)

@geoand
Copy link
Contributor

geoand commented May 2, 2024

Is it possible to not start a container to use the hosts provided ?

I think what you propose makes sense makes sense. As you have already analyzed the code, would you like to provide a PR?

@dcdh
Copy link
Contributor Author

dcdh commented May 2, 2024

Just a question regarding the fix. How can I do - what is the strategy to do integration testing to check that the mongo database has been started or not depending on the properties ?

@geoand
Copy link
Contributor

geoand commented May 2, 2024

I would look at what the existing tests with flapdoodle

@gsmet
Copy link
Member

gsmet commented May 13, 2024

TBH, I would be fine with not having an IT for this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants