Trendyol/stove

Support Quarkus

sherviiin opened this issue · 4 comments

[Question]
Can someone list what exactly needs to be done to support Quarkus?
I might be able to work on that.

Thanks in advance

Hi @sherviiin,

Thanks a lot for your interest!

The idea here is that we could run a Quarkus application with Stove; essentially, it is as simple as adding a SystemUnderTest.

If you look at how Ktor is implemented, it will give an idea.

Steps: Writing a SystemUnderTest

  1. Create a folder named quarkus under starters under it stove-quarkus-testing-e2e folder.
  2. Add this into settings.gradle.kts to include the build
  3. Create a code structure similar to the ktor implementation
  4. Implement the functionality
  5. Create an example Quarkus application and write tests under the examples folder. (don't forget to add it to settings.gradle.kts for build purposes). Example project should be similar to what we have in Spring:
  • HTTP endpoints for a basic Product manipulation
  • Database interaction, Couchbase/Mongo/RDBS (Stove supported ones)
  1. [Optional] Adding stove-quarkus-testing-e2e into the list of publishedProjects in build.gradle.kts

Kafka Integration (optional)

I am unfamiliar with the Quarkus framework, but it would be more appreciated if we could intercept Kafka messages and write assertions for Quarkus. Spring provides consumer and producer interceptors so we can understand the messages and write assertions for them. If Quarkus has a Kafka integration, we could also create a Kafka integration package like stove-spring-testing-e2e-kafka, and it would be stove-quarkus-testing-e2e-kafka.

But the overall idea is just being able to start the process, meaning writing a system under test.

Please let me know if that is enough information to proceed, and don't hesitate to ask any questions!

Thanks @osoykan for the detailed answer.

I'm about to add Quarkus as you broke down the steps. But before that I want to run Ktor example test:
test("should save jedi"){ ... }
I get:

Cannot connect to localhost/<unresolved>:49154
io.r2dbc.postgresql.PostgresqlConnectionFactory$PostgresConnectionException: Cannot connect to localhost/<unresolved>:49154
	at app//io.r2dbc.postgresql.PostgresqlConnectionFactory.cannotConnect(PostgresqlConnectionFactory.java:218)
	at app//reactor.core.publisher.Mono.lambda$onErrorMap$28(Mono.java:3773)
	at app//reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94)
	at app//reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:180)
	at app//reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:106)
	at app//reactor.core.publisher.Operators.error(Operators.java:198)
	at app//reactor.core.publisher.MonoError.subscribe(MonoError.java:53)
	at app//reactor.core.publisher.Mono.subscribe(Mono.java:4485)
	at app//reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103)
	at app//reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:106)
	at app//reactor.core.publisher.Operators.error(Operators.java:198)
	at app//reactor.core.publisher.MonoError.subscribe(MonoError.java:53)
	at app//reactor.core.publisher.Mono.subscribe(Mono.java:4485)
	at app//reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103)
	at app//reactor.core.publisher.FluxMap$MapSubscriber.onError(FluxMap.java:134)
	at app//reactor.core.publisher.MonoDelayUntil$DelayUntilCoordinator.onError(MonoDelayUntil.java:200)
	at app//reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onError(FluxMapFuseable.java:142)
	at app//reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:180)
	at app//reactor.core.publisher.MonoCreate$DefaultMonoSink.error(MonoCreate.java:201)
	at app//reactor.netty.resources.NewConnectionProvider$DisposableConnect.operationComplete(NewConnectionProvider.java:159)
	at app//reactor.netty.resources.NewConnectionProvider$DisposableConnect.operationComplete(NewConnectionProvider.java:105)
	at app//io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590)
	at app//io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:583)
	at app//io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:559)
	at app//io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492)
	at app//io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636)
	at app//io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:629)
	at app//io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:118)
	at app//io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:321)
	at app//io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:337)
	at app//io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)
	at app//io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
	at app//io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
	at app//io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
	at app//io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at app//io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at app//io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base@17.0.6/java.lang.Thread.run(Thread.java:833)
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/[0:0:0:0:0:0:0:1]:49154
Caused by: java.net.ConnectException: Connection refused
	at java.base/sun.nio.ch.Net.pollConnect(Native Method)
	at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
	at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:946)
	at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:337)
	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)

what am I missing here?

Looks like an issue with the environment, more specifically, docker.

Are you running the latest docker engine? IP here seems a little bit strange: Connection refused: localhost/[0:0:0:0:0:0:0:1]:49154

Are you on Windows by any chance? I have never tried running the tests on Windows., though 🤔

You could check the docker desktop application up-to-date and ensure it runs before the tests?

If anyone is interested can continue from where I left, my quarkus knowledge is limited, for now, I've created a spike here: #625