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
flyway connection error for r2dbc in testcontainers in Spring boot versions >= 3.x.x #40325
Comments
Can you please share a minimal example that reproduces the behaviour that you have described? Unless the failure is specific to Kotlin, that example should be written in Java in order to minimise the number of moving parts. |
sure. I will share a minimal example written in Java. Just reiterating to emphasize that the testcontainers r2dbc test code written in kotlin works well for Spring Boot 2.7.18 but throws flyway connection error for any version of Spring Boot 3.x.x |
This public git repo contains the minimal java code showing the problem with flyway, r2dbc, testcontainers and Spring Boot versions >= 3.0.0. https://github.com/sakthi-logn/spring-boot-flyway-r2dbc-testcontainer.git Please do the following steps to reproduce the problem:
I also tried overriding flyway version to the latest using maven BOM overrides in the kotlin gradle.build.kts file but the same error occurred again. So i am not sure if the problem is with flyway. Please let me know if you need more information. |
Thanks for the sample. Unfortunately, it doesn't reproduce the problem with
Looking more closely at the failure above, I can see that the Postgres database is available on
I can also see that Flyway is trying to connect to the same:
From Spring Boot's perspective, everything is behaving as it should here with Flyway being configured to use the JDBC URL of the container. I suspect that there's a problem specific to your environment or Docker networking. The Ryuk problem may also be evidence of this:
I'm going to close this one, for now at least, as I cannot see any evidence of a problem with Spring Boot. I suspect it's an environmental problem that perhaps only occurs with Spring Boot 3.2's version of Testcontainers. |
Yes. I found out that the problem does not occur in Intel Macbooks but occurred only in Apple M3 laptops. So i stopped that VM instance and started a new x86_64 arch Linux VM to run the docker daemon and it worked !! So, the problem seems to have occurred because of the way docker was setup on the apple M3 arm64 arch laptop. |
The code shown below works perfectly fine in Spring Boot version 2.7.18.
It autoconfigures r2dbc and flyway according to the @DynamicPropertySource such that flyway is able to use jdbc connection to the postgres test container and once the data migrations are complete, the service uses r2dbc connection to the same postgres test container for the tests.
But this functionality stopped working for all Spring Boot versions >= 3.x.x.
For example, everything works well for plugin id("org.springframework.boot") version "2.7.18" in build.gradle.kts file.
Just by simply changing the plugin to id("org.springframework.boot") version "3.2.4" and rerunning the test causes flyway to throw this error:
The text was updated successfully, but these errors were encountered: