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

Support Quarkus #71

Open
sherviiin opened this issue Apr 17, 2023 · 3 comments
Open

Support Quarkus #71

sherviiin opened this issue Apr 17, 2023 · 3 comments
Labels

Comments

@sherviiin
Copy link

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

Thanks in advance

@osoykan
Copy link
Collaborator

osoykan commented Apr 18, 2023

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!

@sherviiin
Copy link
Author

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 [email protected]/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?

@osoykan
Copy link
Collaborator

osoykan commented Apr 20, 2023

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?

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

No branches or pull requests

2 participants