quarkusio / quarkus

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

mongodb devservices #23346

Closed m4rchetto closed 2 years ago

m4rchetto commented 2 years ago

Describe the bug

Quarkus with dev profile or test profile not consider this property quarkus.mongodb.devservices.enabled=true

Running @QuarkusTest with property quarkus.mongodb.connection-string unset, the docker image is not installed on docker.

Running test we have:

2022-02-01 17:36:18,318 INFO  [org.mon.dri.cluster] {} (main) Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms'}
2022-02-01 17:36:18,357 INFO  [org.mon.dri.cluster] {} (main) Cluster description not yet available. Waiting for 30000 ms before timing out
2022-02-01 17:36:20,377 INFO  [org.mon.dri.cluster] {} (cluster-ClusterId{value='61f96182d8a5fe5726ce794b', description='null'}-localhost:27017) Exception in monitor thread while connecting to server localhost:27017: com.mongodb.MongoSocketOpenException: Exception opening socket
    at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70)
    at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:165)
    at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:195)
    at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:151)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.ConnectException: Connection refused: connect

On the other hand property quarkus.datasource.devservices seems to work properly

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

quarkus-bot[bot] commented 2 years ago

/cc @evanchooly, @loicmathieu, @stuartwdouglas

geoand commented 2 years ago

Can you please try and clarify a bit? Unfortunately I wasn't able to understand from the description what is going on

m4rchetto commented 2 years ago

The property quarkus.mongodb.devservices.enabled=true is not working in our quarkus application (2.6.3.Final)

The docker mongo container is not running https://quarkus.io/guides/mongodb#running-a-mongodb-database

if we run the command: docker run -ti --rm -p 27017:27017 mongo:4.0 the docker image is created, but the documentation writes that with devservices enabled that command is not necessary to start the container.

The problem is that the container with devservices enable is not starting.

I don't know if is a configuration mongo devservices problem. However if can help, quarkus.datasource.devservices instead start container as expected

Thanks

geoand commented 2 years ago

I just tried the mongodb quickstart changed to use DevServices (by removing quarkus.mongodb.connection-string) and playing with the different values of quarkus.mongodb.devservices.enabled and it worked just fine.

I am going to close this issue, as it works as expected.

However, if you have a sample application that exhibits the problematic behavior, feel free to comment with a link to it.

amoscatelli commented 1 year ago

to tell the truth I am having the same issue ... (I am using podman)

mongodb image is downloaded but container is not started

abondar24 commented 1 year ago

Doesn't work for me. Spent 18 hours on ivestigation and no luck