Open kareemelzayat opened 1 month ago
@dstepanov it seems there is an issue integrating Micronaut Data Hibernate Reactive with Testcontainers and Liquibase.
I tried everything I could to make it work, the test always fails.
Please create a sample app
@dstepanov done! https://github.com/kareemelzayat/demo-micronaut
Expected Behavior
I initiated a micronaut project with Kotlin on Java 21 and the following features:
I am expecting that the generated test file to work out of the box and the test passes. The test file looks like this:
Actual Behaviour
Instead, I am getting the following error:
Looking at the console a bit deeper, it seems that the SQL client URL is not properly calculated:
Notice the literal value
jdbc:tc:postgresql:16.3:///db
, which should instead look something like thisjdbc:postgresql://localhost:55958/test?loggerLevel=OFF
(the generated URL of the testcontainer)Steps To Reproduce
1- Start a Micronaut Projec with Kotlin on Java 21 and Gradle
2- Install the dependencies:
Micronaut Data Hibernate Reactive
:PostgreSQL DB
:Liquibase
:Testcontainers
:3- Adjust the config files:
application.conf
:datasources { default { db-type = "postgres" dialect = "POSTGRES" driverClassName = "org.postgresql.Driver" password = "${DATABASE_PW:password}" url = "jdbc:postgresql://${DATABASE_URL:
localhost:5432
}/mydb" username = "${DATABASE_USER:sa}" } }jpa { default { reactive = true entity-scan { packages = "com.mstqr.domain" } properties { hibernate { connection { db-type = "${datasources.default.db-type}" password = "${datasources.default.password}" url = "${datasources.default.url}" username = "${datasources.default.user}" } show_sql = true hbm2ddl { auto = "none" } } } } }
datasources { default { driverClassName = "org.testcontainers.jdbc.ContainerDatabaseDriver" url = "jdbc:tc:postgresql:16.3:///db" } }
jpa { default { reactive = true properties { hibernate { connection { driverClassName = ${datasources.default.driverClassName} url = ${datasources.default.url} } hbm2ddl { auto = "none" } } } } }