quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.74k stars 2.67k forks source link

Provide a Neo4j (embedded) test resource. #13438

Closed michael-simons closed 2 years ago

michael-simons commented 3 years ago

Description I discovered test resource and their base interface QuarkusTestResourceLifecycleManager. I like the fact that one can take care of

I would like to see this for Neo4j.

Implementation ideas

I have two suggestions. One based on Neo4j Testcontainers which I do maintain (see https://www.testcontainers.org/modules/databases/neo4j/) or one based on our embedded version. This could work much like the H2 resource.

I have a working implementation here: https://github.com/michael-simons/neo4j-from-the-jvm-ecosystem/blob/master/quarkus-reactive/src/test/java/org/neo4j/examples/jvm/quarkus/reactive/movies/EmbeddedNeo4jTestResource.java

I am happy to contribute this in one way or the other to Quarkus.

michael-simons commented 3 years ago

How would you see this implemented, @machi1990 ?

using Neo4j Testharness:

Pro

using Testcontainers

Pro

I would have some cycles in the upcoming weeks to take care of this.

machi1990 commented 3 years ago

Good question @michael-simons , I do not have a recommendation or strong opinion on either really. I've seen both approaches used on the repo.

Maybe @gsmet and @geoand would know better.

geoand commented 3 years ago

Great idea!

I generally prefer the embedded way when it's an option.

Testcontainers for me is great when the service is not a JVM service.

michael-simons commented 3 years ago

One good reason for test containers is that selecting the version would be ideally an init parameter of the test support, pointing to the image in use. Which might even be one held in a local repo with a fixture build in. Quarkus users than wouldn't need to deal with the dependencies of the embedded Neo4j product.

I personally do recommend embedded for stored procedure development and where I am sure I have the last word about the version and dependency management. It's hard on a framework side to keep up with the dependencies it bring.

michael-simons commented 2 years ago

I think this can be closed since we have the dev-services support based on containers for a while now.