All integration tests in a generated reactive application that uses MSSql Server are failing.
Failed to obtain R2DBC Connection; nested exception is java.net.UnknownHostException: Failed to resolve 'localhost:50494;encrypt=false'
Motivation for or Use Case
Restore integration tests in reactive application that uses MSSqlServer
Reproduce the error
Generate a gateway type application with MS SQL Server as dev/prod database (or with attacched .yo-rc)
Start integration tests: ./mvnw verify
Related issues
Related to #19327
Suggest a Fix
The main reason causing this issue is in class TestContainersSpringContextCustomizerFactory.createContextCustomizer()
where we build spring.r2dbc.url from the result of devTestContainer.getTestContainer().getJdbcUrl()
In testcontainer-mssql that jdbc connection url now include the parameter that disable the SSL encryption: ";encrypt=false" (source).
That change breaks mssql R2DBC url for 2 reasons:
r2dbc mssql url does not support ";" separeted parameters
jdbc "encrypt" parameter is replaced by a parameter called "ssl" in r2dbc
Given that for MSSQL R2DBC it is not necessary to turn off SSL encryption (for now), I would suggest to manually remove that param with this statament: devTestContainer.getTestContainer().getJdbcUrl().replace(";encrypt=false", "")
Overview of the issue
All integration tests in a generated reactive application that uses MSSql Server are failing.
Motivation for or Use Case
Restore integration tests in reactive application that uses MSSqlServer
Reproduce the error
./mvnw verify
Related issues
Related to #19327
Suggest a Fix
The main reason causing this issue is in class
TestContainersSpringContextCustomizerFactory.createContextCustomizer()
where we buildspring.r2dbc.url
from the result ofdevTestContainer.getTestContainer().getJdbcUrl()
In testcontainer-mssql that jdbc connection url now include the parameter that disable the SSL encryption: ";encrypt=false" (source).
That change breaks mssql R2DBC url for 2 reasons:
Given that for MSSQL R2DBC it is not necessary to turn off SSL encryption (for now), I would suggest to manually remove that param with this statament:
devTestContainer.getTestContainer().getJdbcUrl().replace(";encrypt=false", "")
JHipster Version(s)
JHipster configuration
.yo-rc.json file
Environment and Tools
openjdk version "11.0.16" 2022-07-19 OpenJDK Runtime Environment Temurin-11.0.16+8 (build 11.0.16+8) OpenJDK 64-Bit Server VM Temurin-11.0.16+8 (build 11.0.16+8, mixed mode)
git version 2.25.1
node: v16.16.0
npm: 7.24.2
Browsers and Operating System