You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use jasync with Testcontainers and run into SSL issues
@Testcontainers
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class MySqlIntegrationsTests {
private val mySqlDatabase = "test"
private val mySqlUser = "test"
private val mySqlPassword = "test"
private val mySqlRootPassword = "test"
private val mySqlPort = 3306
private val logger = LoggerFactory.getLogger("MySQLContainer")
@Container
// using a generic container since MySql Testcontainers forces JDBC driver
val mysqlContainer = GenericContainer<Nothing>("mysql:8.0.34").apply {
withEnv("MYSQL_ROOT_PASSWORD", mySqlRootPassword)
withEnv("MYSQL_DATABASE",mySqlDatabase)
withEnv("MYSQL_USER", mySqlUser)
withEnv("MYSQL_PASSWORD", mySqlPassword)
withExposedPorts(mySqlPort)
// https://bugs.mysql.com/bug.php?id=106459
// it warns to use "--tls-version=''" instead
// but when you use the recommended setting, it crashes
withCommand("--skip-ssl")
withLogConsumer(Slf4jLogConsumer(logger))
waitingFor(Wait.forListeningPort())
}
var connection: ConnectionPool<MySQLConnection>? = null
@BeforeEach
fun beforeEach() {
if (!mysqlContainer.isRunning) {
mysqlContainer.start()
}
val poolConfig = ConnectionPoolConfigurationBuilder(
database = mySqlDatabase,
username = mySqlUser,
password = mySqlPassword,
host = mysqlContainer.host,
port = mysqlContainer.getMappedPort(mySqlPort),
// defaults to Disable, but let's set it anyway
ssl = SSLConfiguration( SSLConfiguration.Mode.Disable)
)
connection = MySQLConnectionBuilder.createConnectionPool(poolConfig)
}
@AfterAll
fun afterAll() {
connection?.disconnect()?.get()
}
@Test
fun `test database connection`() {
val result = connection!!.sendQuery("SELECT 1").get()
val value = result.rows[0].get(0) as Long
assertEquals(1L, value)
}
}
But I'm still getting
java.util.concurrent.ExecutionException: io.netty.handler.codec.EncoderException: java.lang.IllegalStateException: Authentication is not possible over an unsafe connection. Please use SSL or specify 'rsaPublicKey'
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to use jasync with Testcontainers and run into SSL issues
But I'm still getting
Where else do I have to disable SSL?
Beta Was this translation helpful? Give feedback.
All reactions