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

Continuous Testing with Apicurio DevService #26557

Closed
sombraglez opened this issue Jul 5, 2022 · 5 comments · Fixed by #36537
Closed

Continuous Testing with Apicurio DevService #26557

sombraglez opened this issue Jul 5, 2022 · 5 comments · Fixed by #36537
Labels
Milestone

Comments

@sombraglez
Copy link

Describe the bug

When using the Apicurio DevService for testing, continuous testing (re-run from tests) is not working for integration tests (@QuarkusTest).

Expected behavior

Continuous testing using DevServices for Kafka broker and schema registry must be possible

Actual behavior

Re-run from @QuarkusTest with enabled DevService for Kafka broker and schema registry produce the following exception:

: java.lang.RuntimeException: java.lang.RuntimeException: Failed to start quarkus
        at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:632)
        at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:703)
        at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
        at org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestClassConstructor(InvocationInterceptor.java:73)
        at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
        at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
        at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:77)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestClassConstructor(ClassBasedTestDescriptor.java:355)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateTestClass(ClassBasedTestDescriptor.java:302)
        at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateTestClass(ClassTestDescriptor.java:79)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:280)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$4(ClassBasedTestDescriptor.java:272)
        at java.base/java.util.Optional.orElseGet(Optional.java:364)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$5(ClassBasedTestDescriptor.java:271)
        at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:102)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:101)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:66)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$2(NodeTestTask.java:123)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:123)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:90)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:95)
        at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:91)
        at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:60)
        at io.quarkus.deployment.dev.testing.JunitTestRunner$2.run(JunitTestRunner.java:228)
        at io.quarkus.deployment.dev.testing.ModuleTestRunner$2.run(ModuleTestRunner.java:92)
        at io.quarkus.deployment.dev.testing.TestSupport.runInternal(TestSupport.java:388)
        at io.quarkus.deployment.dev.testing.TestSupport$2.run(TestSupport.java:308)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.RuntimeException: Failed to start quarkus
        at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
        at io.quarkus.runtime.Application.start(Application.java:101)
        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.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:237)
        at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:250)
        at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:609)
        at io.quest.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:647)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$10(ClassBasedTestDescriptor.java:381)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:381)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:205)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:80)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
        ... 34 more
Caused by: javax.enterprise.inject.spi.DeploymentException: org.apache.kafka.common.KafkaException: java.lang.IllegalStateException: java.util.concurrent.RejectedExecutionException: event executor terminated
        at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle.onApplicationStart(SmallRyeReactiveMessagingLifecycle.java:46)
        at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle_Observer_onApplicationStart_7f54e4b27c1b49e5e062caa58f1e82797fa01393.notify(Unknown Source)
        at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:323)
        at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:305)
        at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:73)
        at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:130)
        at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:99)
        at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
        at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(Unknown Source)
        ... 50 more
Caused by: org.apache.kafka.common.KafkaException: java.lang.IllegalStateException: java.util.concurrent.RejectedExecutionException: event executor terminated
        at io.smallrye.reactive.messaging.kafka.fault.DeserializerWrapper.configure(DeserializerWrapper.java:54)
        at io.smallrye.reactive.messaging.kafka.impl.ReactiveKafkaConsumer.<init>(ReactiveKafkaConsumer.java:79)
        at io.smallrye.reactive.messaging.kafka.impl.KafkaSource.<init>(KafkaSource.java:94)
        at io.smallrye.reactive.messaging.kafka.KafkaConnector.getPublisherBuilder(KafkaConnector.java:182)
        at io.smallrye.reactive.messaging.kafka.KafkaConnector_Subclass.getPublisherBuilder$$superforward1(Unknown Source)
        at io.smallrye.reactive.messaging.kafka.KafkaConnector_Subclass$$function$$8.apply(Unknown Source)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:53)
        at io.quarkus.smallrye.reactivemessaging.runtime.DuplicatedContextConnectorFactoryInterceptor.intercept(DuplicatedContextConnectorFactoryInterceptor.java:26)
        at io.quarkus.smallrye.reactivemessaging.runtime.DuplicatedContextConnectorFactoryInterceptor_Bean.intercept(Unknown Source)
        at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:40)
        at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
        at io.smallrye.reactive.messaging.kafka.KafkaConnector_Subclass.getPublisherBuilder(Unknown Source)
        at io.smallrye.reactive.messaging.kafka.KafkaConnector_ClientProxy.getPublisherBuilder(Unknown Source)
        at io.smallrye.reactive.messaging.providers.impl.ConnectorFactories.lambda$wrap$4(ConnectorFactories.java:80)
        at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.createPublisher(ConfiguredChannelFactory.java:171)
        at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.register(ConfiguredChannelFactory.java:133)
        at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.initialize(ConfiguredChannelFactory.java:105)
        at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory_ClientProxy.initialize(Unknown Source)
        at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
        at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
        at io.smallrye.reactive.messaging.providers.extension.MediatorManager.start(MediatorManager.java:200)
        at io.smallrye.reactive.messaging.providers.extension.MediatorManager_ClientProxy.start(Unknown Source)
        at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle.onApplicationStart(SmallRyeReactiveMessagingLifecycle.java:41)
        ... 58 more
Caused by: java.lang.IllegalStateException: java.util.concurrent.RejectedExecutionException: event executor terminated
        at io.apicurio.registry.resolver.AbstractSchemaResolver.configure(AbstractSchemaResolver.java:92)
        at io.apicurio.registry.resolver.DefaultSchemaResolver.configure(DefaultSchemaResolver.java:58)
        at io.apicurio.registry.serde.SchemaResolverConfigurer.configure(SchemaResolverConfigurer.java:87)
        at io.apicurio.registry.serde.AbstractKafkaSerDe.configure(AbstractKafkaSerDe.java:70)
        at io.apicurio.registry.serde.AbstractKafkaDeserializer.configure(AbstractKafkaDeserializer.java:67)
        at io.apicurio.registry.serde.avro.AvroKafkaDeserializer.configure(AvroKafkaDeserializer.java:80)
        at io.smallrye.reactive.messaging.kafka.fault.DeserializerWrapper.configure(DeserializerWrapper.java:50)
        ... 82 more
Caused by: java.util.concurrent.RejectedExecutionException: event executor terminated
        at io.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:923)
        at io.netty.util.concurrent.SingleThreadEventExecutor.offerTask(SingleThreadEventExecutor.java:350)
        at io.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:343)
        at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:825)
        at io.netty.util.concurrent.SingleThreadEventExecutor.lazyExecute(SingleThreadEventExecutor.java:820)
        at io.netty.util.concurrent.AbstractScheduledEventExecutor.schedule(AbstractScheduledEventExecutor.java:263)
        at io.netty.util.concurrent.AbstractScheduledEventExecutor.schedule(AbstractScheduledEventExecutor.java:177)
        at io.vertx.core.impl.VertxImpl$InternalTimerHandler.<init>(VertxImpl.java:877)
        at io.vertx.core.impl.VertxImpl.scheduleTimeout(VertxImpl.java:512)
        at io.vertx.core.impl.AbstractContext.setTimer(AbstractContext.java:93)
        at io.vertx.core.impl.EventLoopContext.setTimer(EventLoopContext.java:22)
        at io.vertx.core.http.impl.HttpClientImpl.<init>(HttpClientImpl.java:178)
        at io.vertx.core.impl.VertxImpl.createHttpClient(VertxImpl.java:331)
        at io.vertx.core.impl.VertxImpl.createHttpClient(VertxImpl.java:343)
        at io.vertx.ext.web.client.WebClient.create(WebClient.java:67)
        at io.apicurio.rest.client.VertxHttpClient.<init>(VertxHttpClient.java:47)
        at io.apicurio.rest.client.VertxHttpClientProvider.create(VertxHttpClientProvider.java:24)
        at io.apicurio.rest.client.spi.ApicurioHttpClientFactory.create(ApicurioHttpClientFactory.java:25)
        at io.apicurio.registry.rest.client.RegistryClientFactory.create(RegistryClientFactory.java:79)
        at io.apicurio.registry.rest.client.RegistryClientFactory.create(RegistryClientFactory.java:67)
        at io.apicurio.registry.resolver.AbstractSchemaResolver.configure(AbstractSchemaResolver.java:88)
        ... 88 more
```-

### How to Reproduce?

Using the Quarkus Quickstart for Kafka and Avro (https://github.com/quarkusio/quarkus-quickstarts/tree/main/kafka-avro-schema-quickstart)

1. `mvn quarkus:test`
2. Once all tests have successfully run press `r` to re-run them
3. Quarkus application cannot be started for the integration tests `MovieResourceTest#testHelloEndpoint() java.lang.RuntimeException: Failed to start quarkus`

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

11.0.14

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.10.1.Final

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

Apache Maven 3.8.2

### Additional information

_No response_
@sombraglez sombraglez added the kind/bug Something isn't working label Jul 5, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 5, 2022

/cc @stuartwdouglas

@sombraglez
Copy link
Author

Hi all, this bug can be also reproduced with the Quarkus Version 2.13.0.Final.
To my understanding: how should the DevServices behave in case the tests are rerun? Are they initialized somehow? I wouldn't expect them to be rebooted at all.

@albert0815
Copy link

We are also experiencing this issue with 2.15.3.Final. Is there any workaround to get continuous testing enabled?

@sombraglez
Copy link
Author

Since the error still persist using version 3.1.2 I've tried to debug this problem to understand better if the problems is on the side of Quarkus or if , on the contrary this issue is on the side of Apicurio.

This BuildStep here (https://github.com/quarkusio/quarkus/blob/main/extensions/schema-registry/apicurio/common/deployment/src/main/java/io/quarkus/apicurio/registry/common/ApicurioRegistryClientProcessor.java#L52) initialized the VertxHttpClient for the Apicurio Client. With Continuous Testing the existing Apicurio container is reused and at any restart (re-run) of the tests Quarkus tries to reinitialize the connection for the Apicurio Client.

I can't really judge if this reinitialization from the client's connection is necessary or not. I would really appreciate any help in solving this problem. Continuous testing is a great feature but only if it works in combination with all Dev Services available in Quarkus.

ozangunalp added a commit to ozangunalp/quarkus that referenced this issue Oct 17, 2023
It holds a reference to Vertx, which will be closed on hot reload

Fixes quarkusio#26557
ozangunalp added a commit to ozangunalp/quarkus that referenced this issue Oct 17, 2023
It holds a reference to Vertx, which will be closed on hot reload

Fixes quarkusio#26557
ozangunalp added a commit to ozangunalp/quarkus that referenced this issue Oct 18, 2023
It holds a reference to Vertx, which will be closed on hot reload

Fixes quarkusio#26557
@quarkus-bot quarkus-bot bot added this to the 3.6 - main milestone Oct 18, 2023
@sombraglez
Copy link
Author

Happy to see it will be soon solved. Thanks @ozangunalp

@gsmet gsmet modified the milestones: 3.6 - main, 3.5.1 Oct 26, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 26, 2023
It holds a reference to Vertx, which will be closed on hot reload

Fixes quarkusio#26557

(cherry picked from commit de440ad)
holly-cummins pushed a commit to holly-cummins/quarkus that referenced this issue Feb 8, 2024
It holds a reference to Vertx, which will be closed on hot reload

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

Successfully merging a pull request may close this issue.

3 participants