Open edeandrea opened 2 years ago
/cc @alesj, @ozangunalp
I think the underlying problem is that the Apicurio registry is not exposed outside of the docker network? The test class (which is not running in a container) can not access the container on the docker network.
Hi just wanted to get any information about this? Even after switching my tests to use the KafkaCompanion
, the integration tests are still not able to work.
Clone https://github.com/quarkusio/quarkus-super-heroes, go into either the rest-fights
or event-statistics
directory and run ./mvnw clean verify -Dquarkus.container-image.build=true
. The integration tests fail because the KafkaCompanion
producer/consumer in the ITs can't talk to apicurio.
Hi - any thoughts on this?
Are you using podman? The name of the service uses uppercase characters.
@geoand did the fix got pushed?
@edeandrea seems to be using a fork of superheroes that you and I work on :)
You mean the networking fix? Is so, yes, that is in main (see https://github.com/quarkusio/quarkus/pull/26422)
@cescoffier no I'm using Docker. This fails when running as a GitHub action as well.
The problem is that the test class executing the integration test uses a KafkaCompanion and is unable to reach the apicurio instance started by dev services because. My guess is that
a) the apicurio instance is not exposed outside of the container network
b) the hostname configured by dev services is specific to the container network and not reachable by the host process
I could be wrong though. I just know it doesn't work
First of all, I am running into another issue running integration tests on a container image build. Using minikube as docker machine, the docker host is not on localhost, but on 192.168.205.4. But the test uri's injected into tests with @TestHTTPResource
have localhost
. I had to pass -Dtest.url='http://192.168.205.4:${quarkus.http.port}'
to the command line for it to work.
I think the described error is related. For Kafka dev service it is not an issue : Kafka dev service bootstrap servers config has 2 URLs, one for internal docker network, one for external. So even though docker network hostname kafka-Wm7Ac
is not resolvable from the host, the second URL is. For Apicurio, the registry URL we are getting from the application config is for internal docker network, therefore not accessible from tests running on the host.
I think this was an issue for DB dev services as well. In integration tests dev service DBs are not accessible.
Hi folks. Any progress on this?
I think @ozangunalp had a look but that was a few months ago.
Do we know if this is still an issue?
It was the last time I tried it.
As I mentioned before this is a more global issue with with how dev services are run on integration tests. I haven't spend the time to look at it yet.
I just tried it again and can verify it is still an issue. I think though that the issue is more generic - trying to run @QuarkusIntegrationTest
s where the test itself needs to communicate with a dev service.
In this specific case the test uses the kafka companion to communicate with the kafka broker. The kafka broker is exposed both on the container network and outside so both the app running as a container and the integration test itself can communicate with it.
The apicurio registry though is not exposed outside the container network, so the integration test is not able to communicate with it.
08:09:43 INFO [io.qu.te.co.DefaultDockerContainerLauncher] (main) Executing "docker run --name quarkus-integration-test-ypCCR -i --rm \
-p 65263:65263 \
-p 8444:8444 \
--net=2e06fc91e5bf75ce5161c005fb1feb5c27107c9661ddc8218d513ab8e863bb28 \
--env QUARKUS_LOG_CATEGORY__IO_QUARKUS__LEVEL=INFO \
--env QUARKUS_HTTP_PORT=65263 \
--env QUARKUS_HTTP_SSL_PORT=8444 \
--env TEST_URL=http://0.0.0.0:0 \
--env MP_MESSAGING_CONNECTOR_SMALLRYE_KAFKA_APICURIO_REGISTRY_URL=http://kafka-nbjgm:8080/apis/registry/v2 \
--env QUARKUS_HTTP_HOST=0.0.0.0 \
--env KAFKA_BOOTSTRAP_SERVERS=PLAINTEXT://kafka-kfz5i:29092,OUTSIDE://localhost:55011 \
--env QUARKUS_CONTAINER_IMAGE_BUILD=true \
--env MP_MESSAGING_CONNECTOR_SMALLRYE_KAFKA_SCHEMA_REGISTRY_URL=http://kafka-nbjgm:8080/apis/ccompat/v6 \
quay.io/quarkus-super-heroes/event-statistics:1.0"
Describe the bug
I have an application which listens for events on Kafka and processes them. This application also uses an Apicurio schema registry. This application has integration tests which use a
QuarkusTestResourceLifecycleManager
to create aKafkaProducer
to "drop" events onto the Kafka topic for the application to consume in the tests. The Kafka broker & Apicurio schema registry are started/provided by Dev Services.https://github.com/quarkusio/quarkus-super-heroes/blob/main/event-statistics/src/test/java/io/quarkus/sample/superheroes/statistics/KafkaProducerResource.java is the class, and https://github.com/quarkusio/quarkus-super-heroes/tree/main/event-statistics is the application. The test resource class is reading the
mp.messaging.connector.smallrye-kafka.apicurio.registry.url
property provided by the Apicurio dev services and setting it's value as theSerdeConfig.REGISTRY_URL
in theKafkaProducer
config.When running the integration tests against a containerized JVM version of the application (i.e. when running
./mvnw clean verify -Dquarkus.container-image.build=true
) theKafkaProducer
doesn't appear to be able to communicate with the Apicurio schema registry.Expected behavior
I would expect that my integration test should be able to interact with the Apicurio schema registry started by dev services.
Actual behavior
When I try to run the IT tests I can see in the logs that it is starting the container and specifying the network:
My question is - how do I use that
containerNetworkId
in the construction of theKafkaProducer
, specifically in theSerdeConfig.REGISTRY_URL
pointing to the apicurio registry? It doesn't appear that the apicurio instance is exposed outside of the container network. The tests fail with:How to Reproduce?
No response
Output of
uname -a
orver
Darwin edeandre-mac 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64 x86_64
Output of
java -version
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.7.2.Final (but has been nagging me for a few releases now)
Build tool (ie. output of
mvnw --version
orgradlew --version
)Additional information
No response