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

Failing pulsar-devservice-containing @QuarkusIntegrationTest for container-image.build=true on MacOS #44264

Closed
jgardo opened this issue Nov 1, 2024 · 4 comments · Fixed by #44265

Comments

@jgardo
Copy link
Contributor

jgardo commented Nov 1, 2024

Describe the bug

This bug is similar to #43980

The @QuarkusIntegrationTest in the project, whose final artefact is Jib-built docker image, tests this built image.

If there is Pulsar dev services required for this integration test, those Pulsar adresses are passed with properties pulsar.client.serviceUrl and pulsar.admin.serviceUrl. The hosts of these addresses are defined as localhost, 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 via localhost.

We can observe this behaviour in the logs:

2024-11-01 22:04:48,511 INFO  [io.qua.tes.com.DefaultDockerContainerLauncher] (main) Executing "docker run --name quarkus-integration-test-OCzQj -i --rm -p 8081:8081 -p 8444:8444 --net=a058ee16d4aebf6cd18e05878bdc9f12da3e93e67dd2ad3356b96b57939ddc0e --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 PULSAR_ADMIN_SERVICEURL=http://localhost:54242 --env PULSAR_CLIENT_SERVICEURL=pulsar://localhost:54241 code-with-quarkus:1.0.0-SNAPSHOT"

Expected behavior

The tested container should access Pulsar devservice via container's domain name (e.g. pulsar://pulsar-hash:6650 or http://pulsar-hash:8080) instead of localhost:<mappedPort>) in shared network.

Actual behavior

Accessing devservices on MacOS within Docker container via localhost causes java.net.ConnectException: Connection refused.

How to Reproduce?

  1. Create example project quarkus create app
  2. Add docker image building extension - quarkus extension add container-image-jib
  3. Require building docker image by specifying Maven property <quarkus.container-image.build>true</quarkus.container-image.build>
  4. Require running IT tests by specifying Maven property <skipITs>false</skipITs>
  5. Add example required Pulsar devservice
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-messaging-pulsar</artifactId>
        </dependency>
  1. Use devservice in application
  2. Run ./mvnw clean install

code-with-quarkus.zip

Output of uname -a or ver

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 or gradlew --version)

Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256) Maven home: /Users/jakub.gardo/.m2/wrapper/dists/apache-maven-3.9.8-bin/337e6d14/apache-maven-3.9.8 Java version: 21, vendor: Oracle Corporation, runtime: /Users/jakub.gardo/.sdkman/candidates/java/21-open 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

Copy link

quarkus-bot bot commented Nov 1, 2024

/cc @geoand (devservices,jib,testing), @stuartwdouglas (devservices)

@geoand
Copy link
Contributor

geoand commented Nov 4, 2024

cc @ozangunalp

@ozangunalp
Copy link
Contributor

Indeed I see that we don't have the shared network handling for Quarkus integration tests on the Pulsar dev service.

@quarkus-bot quarkus-bot bot added this to the 3.17 - main milestone Nov 12, 2024
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.

4 participants
@ozangunalp @geoand @jgardo and others