Failing devservices-containing @QuarkusIntegrationTest for container-image.build=true
on MacOS
#43980
Labels
Milestone
container-image.build=true
on MacOS
#43980
Describe the bug
The
@QuarkusIntegrationTest
in the project, whose final artefact is Jib-built docker image, tests this built image.If there are dev services required for this integration test, those dependency adresses are passed with properties, e.g.
quarkus.elasticsearch.hosts
. The hosts of these addresses are defined aslocalhost
, which is correct for jar testing.Problem occurs for MacOS. In the MacOS, Docker container
localhost
refers only to "this-container-localhost", which causes failure of reaching devservices vialocalhost
.We can observe this behaviour in the logs:
2024-10-19 23:38:45,069 INFO [io.qua.tes.com.DefaultDockerContainerLauncher] (main) Executing "docker run --name quarkus-integration-test-SfkPp -i --rm -p 8081:8081 -p 8444:8444 --net=834f31302c23d79e9deb7a0f691fad3f15d419301763337c2901b96d269c2ce2 --env QUARKUS_LOG_CATEGORY__IO_QUARKUS__LEVEL=INFO --env QUARKUS_HTTP_PORT=8081 --env QUARKUS_HTTP_SSL_PORT=8444 --env TEST_URL=http://localhost:8081 --env QUARKUS_ELASTICSEARCH_HOSTS=localhost:50383 code-with-quarkus:1.0.0-SNAPSHOT"
Expected behavior
The tested container should access devservices via container's domain name (e.g.
elasticsearch:9200
instead oflocalhost:<mappedPort>
) in shared network.Other workaround specific for MacOS could be replacing
localhost:<mappedPort>
withhost.docker.internal:<mappedPort>
.Actual behavior
Accessing devservices on MacOS within
Docker container
vialocalhost
causesjava.net.ConnectException: Connection refused
.How to Reproduce?
Reproducing project: code-with-quarkus.zip
Steps to create such project:
quarkus create app
quarkus extension add container-image-jib
<quarkus.container-image.build>true</quarkus.container-image.build>
<skipITs>false</skipITs>
mvn clean install
Output of
uname -a
orver
Darwin MacBook-Pro.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/RELEASE_X86_64 x86_64
Output of
java -version
openjdk version "21" 2023-09-19 OpenJDK Runtime Environment (build 21+35-2513) OpenJDK 64-Bit Server VM (build 21+35-2513, mixed mode, sharing)
Quarkus version or git rev
3.15.1
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9) Java version: 21, vendor: Oracle Corporation Default locale: en_GB, platform encoding: UTF-8 OS name: "mac os x", version: "14.5", arch: "x86_64", family: "mac"
Additional information
No response
The text was updated successfully, but these errors were encountered: