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

Shared DevServices Container for MongoDB Like Kafka in Quarkus #38678

Open
Byte2024bender opened this issue Feb 8, 2024 · 29 comments
Open

Shared DevServices Container for MongoDB Like Kafka in Quarkus #38678

Byte2024bender opened this issue Feb 8, 2024 · 29 comments

Comments

@Byte2024bender
Copy link

Description

I am working on a Quarkus application that consists of several components. I've noticed that while using DevServices for Kafka a shared single container across all components is used, which is efficient and resource-saving. However, for MongoDB, each component spawns its own container, leading to increased resource consumption on local dev computer.

I would like to request a feature for Quarkus DevServices that allows MongoDB to behave similarly to Kafka in terms of container sharing. Specifically, the ability to configure MongoDB DevServices to use a single shared container across multiple application components, instead of creating a separate container for each component. This feature should be configurable, allowing developers to choose between shared and individual containers based on their specific needs.

Configuration idea:
quarkus.mongodb.devservices.shared=true
quarkus.mongodb.devservices.shared-container-name=myMongoDevContainer

Implementation ideas

No response

Copy link

quarkus-bot bot commented Feb 8, 2024

/cc @alesj (kafka), @cescoffier (kafka), @geoand (devservices), @loicmathieu (mongodb), @ozangunalp (kafka), @stuartwdouglas (devservices)

@cescoffier
Copy link
Member

It should be possible without too much trouble. Fancy a PR if we guide you?

@alesj
Copy link
Contributor

alesj commented Feb 12, 2024

@cescoffier what about if we try it with the new "dev resources" concept?
... although MongoDB doesn't really fall into "observability", but we could see if the "dev resources" concept really works as it's meant to be -- simple to add new dev service (re-usable / shared containers)

@patrox
Copy link
Contributor

patrox commented Mar 8, 2024

I could address this request, similarly, as it was done for redis, kafka and others, eg: #18029 - if this is still acceptable.

@cescoffier
Copy link
Member

@patrox definitely!

@Inithron
Copy link

Inithron commented Mar 21, 2024

@patrox @cescoffier do I understand it correctly, that this issue is fixed? If so when will it be delivered?

@cescoffier
Copy link
Member

No it has not been fixed yet.

@patrox
Copy link
Contributor

patrox commented Mar 21, 2024

@Inithron I'm close to completing it, hopefully, it shouldn't take too long - expect a PR within a week!

@patrox
Copy link
Contributor

patrox commented Mar 29, 2024

Added a PR that should address this issue: #39787

@loicmathieu Can I please kindly ask you for a review?

@Inithron
Copy link

Inithron commented May 5, 2024

Is there any progress on this issue?

@Inithron
Copy link

Inithron commented Jun 6, 2024

@patrox @gsmet can one of you give me an update? I see there is already pull request but since two month there is no progress.

@patrox
Copy link
Contributor

patrox commented Jun 6, 2024

@patrox @gsmet can one of you give me an update? I see there is already pull request but since two month there is no progress.

Hey @Inithron, I'm waiting for @gsmet re-review, as I addressed all his requested changes.

@Inithron
Copy link

Hi @patrox, hi @gsmet,
I am a little bit confused. This issue is open but the merge request #39787 is in stage merged and the last comment was that it is part of 3.12. So I did the update to 3.12 and tested it but it is still not working. When I start two applications in dev mode, two mongo container are started. And if I set the property quarkus.mongodb.devservices.port=27017 in both applications I got the following error message in second one I start:

2024-06-29 20:41:24,879�[39m�[38;5;188m �[39m�[38;5;203mERROR�[39m�[38;5;188m [�[39m�[38;5;69mtc.doc.io/.4�[39m�[38;5;188m] (�[39m�[38;5;71mbuild-50�[39m�[38;5;188m) �[39m�[38;5;151mCould not start container�[39m�[38;5;203m: com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"cause":"address already in use","message":"cannot listen on the TCP port: listen tcp4 :27017: bind: address already in use","response":500}

	at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
	at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.post(DefaultInvocationBuilder.java:102)
	at org.testcontainers.shaded.com.github.dockerjava.core.exec.StartContainerCmdExec.execute(StartContainerCmdExec.java:31)
	at org.testcontainers.shaded.com.github.dockerjava.core.exec.StartContainerCmdExec.execute(StartContainerCmdExec.java:13)
	at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
	at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33)
	at org.testcontainers.shaded.com.github.dockerjava.core.command.StartContainerCmdImpl.exec(StartContainerCmdImpl.java:42)
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:452)
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:354)
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:344)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:330)
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.lambda$startMongo$0(DevServicesMongoProcessor.java:191)
	at java.base/java.util.Optional.orElseGet(Optional.java:364)
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:207)
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:112)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.jboss.threads.JBossThread.run(JBossThread.java:483)
�[39m�[38;5;227m
�[39m�[38;5;145m2024-06-29 20:41:24,888�[39m�[38;5;188m �[39m�[38;5;203mERROR�[39m�[38;5;188m [�[39m�[38;5;69mtc.doc.io/.4�[39m�[38;5;188m] (�[39m�[38;5;71mbuild-50�[39m�[38;5;188m) �[39m�[38;5;151mThere are no stdout/stderr logs available for the failed container�[39m�[38;5;203m�[39m�[38;5;227m
�[39m�[38;5;145m2024-06-29 20:41:24,894�[39m�[38;5;188m �[39m�[38;5;107mINFO �[39m�[38;5;188m [�[39m�[38;5;69mio.qua.dep.dev.IsolatedDevModeMain�[39m�[38;5;188m] (�[39m�[38;5;71mmain�[39m�[38;5;188m) �[39m�[38;5;151mAttempting to start live reload endpoint to recover from previous Quarkus startup failure�[39m�[38;5;203m�[39m�[38;5;227m
�[39m�[38;5;145m2024-06-29 20:41:25,169�[39m�[38;5;188m �[39m�[38;5;203mERROR�[39m�[38;5;188m [�[39m�[38;5;69mio.qua.dep.dev.IsolatedDevModeMain�[39m�[38;5;188m] (�[39m�[38;5;71mmain�[39m�[38;5;188m) �[39m�[38;5;151mFailed to start quarkus�[39m�[38;5;203m: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.mongodb.deployment.DevServicesMongoProcessor#startMongo threw an exception: java.lang.RuntimeException: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image docker.io/mongo:4.4
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:122)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.jboss.threads.JBossThread.run(JBossThread.java:483)
Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image docker.io/mongo:4.4
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:359)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:330)
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.lambda$startMongo$0(DevServicesMongoProcessor.java:191)
	at java.base/java.util.Optional.orElseGet(Optional.java:364)
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:207)
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:112)
	... 12 more
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:344)
	... 17 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:563)
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:354)
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	... 18 more
Caused by: com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"cause":"address already in use","message":"cannot listen on the TCP port: listen tcp4 :27017: bind: address already in use","response":500}

	at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
	at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.post(DefaultInvocationBuilder.java:102)
	at org.testcontainers.shaded.com.github.dockerjava.core.exec.StartContainerCmdExec.execute(StartContainerCmdExec.java:31)
	at org.testcontainers.shaded.com.github.dockerjava.core.exec.StartContainerCmdExec.execute(StartContainerCmdExec.java:13)
	at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
	at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33)
	at org.testcontainers.shaded.com.github.dockerjava.core.command.StartContainerCmdImpl.exec(StartContainerCmdImpl.java:42)
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:452)
	... 20 more

	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:331)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:252)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:58)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:113)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:435)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:56)
	at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
	at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
	at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
	at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.mongodb.deployment.DevServicesMongoProcessor#startMongo threw an exception: java.lang.RuntimeException: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image docker.io/mongo:4.4
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:122)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.jboss.threads.JBossThread.run(JBossThread.java:483)
Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image docker.io/mongo:4.4
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:359)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:330)
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.lambda$startMongo$0(DevServicesMongoProcessor.java:191)
	at java.base/java.util.Optional.orElseGet(Optional.java:364)
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:207)
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:112)
	... 12 more
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:344)
	... 17 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:563)
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:354)
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	... 18 more
Caused by: com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"cause":"address already in use","message":"cannot listen on the TCP port: listen tcp4 :27017: bind: address already in use","response":500}

	at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
	at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.post(DefaultInvocationBuilder.java:102)
	at org.testcontainers.shaded.com.github.dockerjava.core.exec.StartContainerCmdExec.execute(StartContainerCmdExec.java:31)
	at org.testcontainers.shaded.com.github.dockerjava.core.exec.StartContainerCmdExec.execute(StartContainerCmdExec.java:13)
	at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
	at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33)
	at org.testcontainers.shaded.com.github.dockerjava.core.command.StartContainerCmdImpl.exec(StartContainerCmdImpl.java:42)
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:452)
	... 20 more

	at io.quarkus.builder.Execution.run(Execution.java:123)
	at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
	at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:160)
	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:327)
	... 9 more
Caused by: java.lang.RuntimeException: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image docker.io/mongo:4.4
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:122)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.jboss.threads.JBossThread.run(JBossThread.java:483)
Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image docker.io/mongo:4.4
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:359)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:330)
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.lambda$startMongo$0(DevServicesMongoProcessor.java:191)
	at java.base/java.util.Optional.orElseGet(Optional.java:364)
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:207)
	at io.quarkus.mongodb.deployment.DevServicesMongoProcessor.startMongo(DevServicesMongoProcessor.java:112)
	... 12 more
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:344)
	... 17 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:563)
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:354)
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	... 18 more
Caused by: com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"cause":"address already in use","message":"cannot listen on the TCP port: listen tcp4 :27017: bind: address already in use","response":500}

	at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:247)
	at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.post(DefaultInvocationBuilder.java:102)
	at org.testcontainers.shaded.com.github.dockerjava.core.exec.StartContainerCmdExec.execute(StartContainerCmdExec.java:31)
	at org.testcontainers.shaded.com.github.dockerjava.core.exec.StartContainerCmdExec.execute(StartContainerCmdExec.java:13)
	at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
	at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33)
	at org.testcontainers.shaded.com.github.dockerjava.core.command.StartContainerCmdImpl.exec(StartContainerCmdImpl.java:42)
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:452)
	... 20 more
�[39m�[38;5;227m

So my question now: Is the issue not solved properly, or is it still not part of version 3.12?

@Inithron
Copy link

Inithron commented Jul 7, 2024

Same behavior with version 3.12.1. Should i create a new issue that the shared-server is not working?

@loicmathieu
Copy link
Contributor

@patrox can you have a look please?

@Inithron
Copy link

Inithron commented Aug 4, 2024

Hi,
Currently the shared server of the MongoDB extension and the shared broker of the Kafka extension are not working properly. For both issues exists already: #38678 & #41788. But on both issues is since one month no or no more progress. So I did a research to see if the creator of these issues and I am the only one who are affect of this problem, or if there are more. And I figured out that there are more. Here is a list of all open issues which are (from my point of view) related to the problem:

As a short summary:
It should be possible to share resources in dev and in test mode. It is totally fine not to share the resources in test mode by default, but at least there should be the possibility to enable this option.

Due to the case that many extensions are affected by this issue, it would be great to solve this issue in a central place, if possible. If not maybe the contributors of the different extensions could support each other to solve the issues for each extension individually.

@geoand
Copy link
Contributor

geoand commented Aug 4, 2024

Hello,

Although the desire to have the issue(s) addressed it totally understandable, it is pretty counterproductive to copy and paste the comment across various issues.
I would urge a little more restraint next time.

Thanks

@Inithron
Copy link

Inithron commented Aug 4, 2024

Hi @geoand,
Sorry for this. I am new in Github and I was not aware that Github links the related issues automatically. I have also recognized this but only after I have copied the comment to all other issues. Now I have deleted the comments from the other issues again.

@geoand
Copy link
Contributor

geoand commented Aug 4, 2024

No problem 😃

@Inithron
Copy link

Inithron commented Oct 2, 2024

After the update to Quarkus 3.15.1 i tested it again but it is still not working. @patrox you tried to fix it 6 month ago. Can you maybe try it again?

@cescoffier
Copy link
Member

It is totally fine not to share the resources in test mode by default, but at least there should be the possibility to enable this option.

That's not true for every dev service. Do that with Kafka, and if you are not very careful (consumer groups different between test and dev), it won't do what you think.

You mentioned that the shared broker does not work for Kafka. Do you have an issue with that? I just tried, and it worked perfectly.

@Inithron
Copy link

Hi @cescoffier,

You are right. For Kafka it was a little bit tricky but now we can execute the unit tests of our components parallelly on a single Kafka instance.

Did you test the shared broker in dev or in test mode? Because as mentioned in #41788 the shared broker works only in dev mode but not in test mode. When we use the dev services in test mode, each test instance tries to start its own broker.

@cescoffier
Copy link
Member

This is exactly why we do not share brokers in test mode and restart a fresh one every time.

@Inithron
Copy link

Inithron commented Oct 13, 2024

I do not understand your answer. What exactly do you mean? And why do you not want to provide the possibility to share the broker in test mode for the ones who want to use it?

@cescoffier
Copy link
Member

Because it requires advanced knowledge about Kafka to use that properly. In this case, I would recommend using a separate broker.

@Inithron
Copy link

Inithron commented Oct 14, 2024

In our team this knowledge is available. But we can't use a separate broker. We have a Gradle multi project build. And to decrease the build time, we have enabled the option org.gradle.parallel=true (which makes a huge difference). But that means that the compilation and the unit tests of the different projects are executed in parallel. Our projects uses different extensions, but most of them use the MongoDB and Kafka extension. With a single MongoDB and Kafka instance everything is working. But if each project would setup its own MongoDB and Kafka instance / broker the laptops of our develops would crash because they have not enough resources to support this approach. Currently every developer has to start the MongoDB and Kafka manually before he can execute the unit tests. Of course this is working, but it would be great if this could be avoided and we could use a shared MongoDB and Kafka instance also in test mode. In dev mode it is already working, at least for the Kafka extension. So why do you not want to provide this feature for the test mode, too? I can understand that sharing recourses in test mode should not be the default behavior. But why should it not be possible by enable it via a property?

@Inithron
Copy link

Inithron commented Oct 29, 2024

Hi @cescoffier,
I would like to get your thoughts about my last comment. Do you still think it should not be possible so share resources in test mode?

@cescoffier
Copy link
Member

cescoffier commented Oct 29, 2024

It should not be the default and should be carefully and explicitly enabled. The default should always be a clear separation between dev and test.

@ozangunalp has been working on some docker compose support that may be usable in this case.

Also, I'm not sure I understand the multi-module parts - are they all running at the same time?

@Inithron
Copy link

Inithron commented Oct 29, 2024

It depends. If the sub-projects has dependencies between each other, Gradle builds the projects sequentially. But if not then the compilation and test of the sub-projects are executed at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants