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

Multiple devservices leads to Ryuk started twice and the Dockerfactory initialized twice #27243

Open
loicmathieu opened this issue Aug 11, 2022 · 8 comments
Assignees
Labels
area/devservices area/kafka env/windows Impacts Windows machines kind/bug Something isn't working

Comments

@loicmathieu
Copy link
Contributor

loicmathieu commented Aug 11, 2022

Describe the bug

When using multiple devservices: Kafka via the Kafka Companion test extension and Apicurio Service Registry, Ryuk is started twice and the Dockerfactory is initialized twice.
Everything works but it make the test a bit longuer that necessary.

See the following log:

2022-08-10 16:13:50,388 INFO  [org.tes.doc.DockerClientProviderStrategy] (build-32) Loaded org.testcontainers.dockerclient.NpipeSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
2022-08-10 16:13:52,296 INFO  [org.tes.doc.DockerClientProviderStrategy] (build-32) Found Docker environment with local Npipe socket (npipe:////./pipe/docker_engine)
2022-08-10 16:13:52,301 INFO  [org.tes.DockerClientFactory] (build-32) Docker host IP address is localhost
2022-08-10 16:13:52,335 INFO  [org.tes.DockerClientFactory] (build-32) Connected to docker:
  Server Version: 20.10.16
  API Version: 1.41
  Operating System: Rancher Desktop WSL Distribution
  Total Memory: 12634 MB
2022-08-10 16:13:52,368 INFO  [org.tes.uti.ImageNameSubstitutor] (build-32) Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
2022-08-10 16:13:52,540 INFO  [? .io/.2.3.Final]] (build-32) Creating container for image: quay.io/apicurio/apicurio-registry-mem:2.2.3.Final
2022-08-10 16:13:52,943 INFO  [org.tes.uti.RegistryAuthLocator] (build-32) Credential helper/store (docker-credential-wincred) does not have credentials for quay.io
2022-08-10 16:13:52,982 INFO  [? .3.3]] (build-32) Creating container for image: testcontainers/ryuk:0.3.3
2022-08-10 16:13:53,158 INFO  [org.tes.uti.RegistryAuthLocator] (build-32) Credential helper/store (docker-credential-wincred) does not have credentials for https://index.docker.io/v1/
2022-08-10 16:13:53,390 INFO  [? .3.3]] (build-32) Container testcontainers/ryuk:0.3.3 is starting: 80ef395ab1ccc70eb1a3253aa42bab022bcad1c8fb67d9e67a9e381fdfb6f761
2022-08-10 16:13:54,156 INFO  [? .3.3]] (build-32) Container testcontainers/ryuk:0.3.3 started in PT1.1762145S
2022-08-10 16:13:54,495 INFO  [? .io/.2.3.Final]] (build-32) Container quay.io/apicurio/apicurio-registry-mem:2.2.3.Final is starting: f6e5262c08f0b9646e6823ccb0c398706c78d3b6409d81ce33c558d6d95b8503
2022-08-10 16:14:00,310 INFO  [? .io/.2.3.Final]] (build-32) Container quay.io/apicurio/apicurio-registry-mem:2.2.3.Final started in PT7.9259169S
2022-08-10 16:14:00,312 INFO  [io.qua.api.reg.dev.DevServicesApicurioRegistryProcessor] (build-32) Dev Services for Apicurio Registry started. The registry is available at http://localhost:49438/apis/registry/v2
2022-08-10 16:14:00,773 INFO  [org.tes.uti.ImageNameSubstitutor] (main) Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
2022-08-10 16:14:00,830 INFO  [org.tes.doc.DockerClientProviderStrategy] (pool-4-thread-1) Loaded org.testcontainers.dockerclient.NpipeSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
2022-08-10 16:14:01,819 INFO  [org.tes.doc.DockerClientProviderStrategy] (pool-4-thread-1) Found Docker environment with local Npipe socket (npipe:////./pipe/docker_engine)
2022-08-10 16:14:01,821 INFO  [org.tes.DockerClientFactory] (pool-4-thread-1) Docker host IP address is localhost
2022-08-10 16:14:01,853 INFO  [org.tes.DockerClientFactory] (pool-4-thread-1) Connected to docker:
  Server Version: 20.10.16
  API Version: 1.41
  Operating System: Rancher Desktop WSL Distribution
  Total Memory: 12634 MB
2022-08-10 16:14:01,879 INFO  [io.str.tes.con.KafkaVersionService] (pool-4-thread-1) Latest release of Kafka is:LogicalKafkaVersionEntity{version='3.2.0', image='quay.io/strimzi-test-container/test-container:0.102.0-kafka-3.2.0'}
2022-08-10 16:14:01,879 INFO  [io.str.tes.con.KafkaVersionService] (pool-4-thread-1) Latest release of Kafka is:LogicalKafkaVersionEntity{version='3.2.0', image='quay.io/strimzi-test-container/test-container:0.102.0-kafka-3.2.0'}
2022-08-10 16:14:01,880 INFO  [io.str.tes.con.KafkaVersionService] (pool-4-thread-1) No Kafka version specified. Using latest release: quay.io/strimzi-test-container/test-container:0.102.0-kafka-3.2.0
2022-08-10 16:14:02,032 INFO  [? .io/.102.0-k.2.0]] (pool-4-thread-1) Creating container for image: quay.io/strimzi-test-container/test-container:0.102.0-kafka-3.2.0
2022-08-10 16:14:02,392 INFO  [org.tes.uti.RegistryAuthLocator] (pool-4-thread-1) Credential helper/store (docker-credential-wincred) does not have credentials for quay.io
2022-08-10 16:14:02,426 INFO  [? .3.3]] (pool-4-thread-1) Creating container for image: testcontainers/ryuk:0.3.3
2022-08-10 16:14:02,601 INFO  [org.tes.uti.RegistryAuthLocator] (pool-4-thread-1) Credential helper/store (docker-credential-wincred) does not have credentials for https://index.docker.io/v1/
2022-08-10 16:14:02,828 INFO  [? .3.3]] (pool-4-thread-1) Container testcontainers/ryuk:0.3.3 is starting: cc9b40e19b3dcad704b2698c7fda6b423c0aa5036561711617bcee6c05d7dd4f
2022-08-10 16:14:03,665 INFO  [? .3.3]] (pool-4-thread-1) Container testcontainers/ryuk:0.3.3 started in PT1.2393086S
2022-08-10 16:14:04,452 INFO  [? .io/.102.0-k.2.0]] (pool-4-thread-1) Container quay.io/strimzi-test-container/test-container:0.102.0-kafka-3.2.0 is starting: 3684303af8ea022d5597853dbd2ece0b81ec8834463bb291e68abf7839fee4a8
2022-08-10 16:14:05,600 INFO  [io.str.tes.con.StrimziKafkaContainer] (pool-4-thread-1) Mapped port: 49440
2022-08-10 16:14:05,601 INFO  [io.str.tes.con.StrimziKafkaContainer] (pool-4-thread-1) This is all advertised listeners for Kafka PLAINTEXT://localhost:49440,BROKER1://192.168.48.2:9093
2022-08-10 16:14:05,603 INFO  [io.str.tes.con.StrimziKafkaContainer] (pool-4-thread-1) Copying command to 'STARTER_SCRIPT' script.
2022-08-10 16:14:11,871 INFO  [? .io/.102.0-k.2.0]] (pool-4-thread-1) Container quay.io/strimzi-test-container/test-container:0.102.0-kafka-3.2.0 started in PT9.991376S

Expected behavior

Ryuk and the Dockerfactory are only started once.

Actual behavior

No response

How to Reproduce?

Reproducer is here:
multiple-dev-services.zip

Output of uname -a or ver

Microsoft Windows [version 10.0.19044.1826]

Output of java -version

openjdk version "18" 2022-03-22

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.11.2

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

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)

Additional information

No response

@loicmathieu loicmathieu added the kind/bug Something isn't working label Aug 11, 2022
@quarkus-bot quarkus-bot bot added area/devservices env/windows Impacts Windows machines labels Aug 11, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Aug 11, 2022

/cc @geoand, @stuartwdouglas

@loicmathieu
Copy link
Contributor Author

It only occurs when both devservices and Kafka companion is used and kafka.bootstrap.servers is set, in this case normal Kafka devservices is not started by default as the props is set by Kafka test companion start one.

So, I'm not sure it's a bug per se ;)

@loicmathieu
Copy link
Contributor Author

If I unset kafka.bootstrap.servers Docker is setuped once a redpanda container starts that is not compatible with the Kafka Companion or the schema registry ...

Configuring devservices to quarkus.kafka.devservices.image-name=quay.io/strimzi-test-container/test-container:0.100.0-kafka-3.1.0 solves it.

So it raises multiple questions:

  • Is schema registry / Kafka companion compatible with redpanda ?
  • Why dies Kafka companion re-launch Docker if it founds kafka.bootstrap.server options ?

@ozangunalp
Copy link
Contributor

I need to check but KafkaCompanionResource did verify if kafka.bootstrap.servers is set on devservices context.
I think, the fact that you are seeing ryuk twice means test containers was init from multiple classpath (build and tests ?)
I'll investigate this.

@ozangunalp ozangunalp self-assigned this Aug 11, 2022
@ozangunalp
Copy link
Contributor

I believe this is fixed by #28702. @loicmathieu can you verify it again?

@loicmathieu
Copy link
Contributor Author

@ozangunalp no, I can still saw Ruyk started twice when using the Kafka Companion using Quarkus 2.13.4.

@GauthierHacout
Copy link

Hello,

I experienced this issue too, it took me a while to understand what was going on and if my test failures were due to the fact that multiple Kafka instances were started or not.

Here's a simple reproducer based on Quarkus Kafka starter code : https://github.com/GauthierHacout/quarkus_test_kafka
(There's a single test and it showcases the behavior)

2023-09-20 15:38:30,154 INFO  [tc.tes.5.1] (build-11) Container testcontainers/ryuk:0.5.1 is starting: 1aa4841619e5f345bf75c48b34334b4334cfb20a51a445a5b1ad21b2da841284
2023-09-20 15:38:30,613 INFO  [tc.doc.io/.3.4] (build-17) Container docker.io/vectorized/redpanda:v22.3.4 is starting: 83f7c375f6631cda758466469cbef1cee1589361534c0b516667d55e28a2c9f8

Maybe even more bizarre, when I add the config quarkus.kafka.devservices.enabled=false inside my application.properties I end up with not 2 but 3 Kafka instances started in test.

My test still works though, but it's quite distracting when looking for reason of test failures ! I hope this can help to investigate the issue.

I used Quarkus 3.3.2 btw

@ozangunalp
Copy link
Contributor

Having 2 instances of dev services during dev mode is normal as test execution creates their own devservice instances. When dev services are disabled the KafkaCompanionResource starts its own Kafka broker. Maybe that's what you are seeing.

But these are not related to the original issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devservices area/kafka env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants