Skip to content

Without mysql driver, MySQLContainer keeps waiting instead fail fast #1797

Description

@ryukato

when mysql-connector-java depedenecy is not set, then it looks like test-container keep waiting for logger time. (it look like hang :( ). I think it throws a sort of an exception and stop.
Could you guyes take a look at the issue? I put some more details below.

Details to reproduce issue

Language: Kotlin
Test container version: 1.11.3
TestContainer Module: MySQLContainer

Pre-condition

  • Not adding no mysql-connector depedenecy

Sample Codes

@RunWith(SpringRunner::class)
@SpringBootTest()
class TestWithMysqlContainerModule {

    companion object {
        const val TEST_DATABASE_NAME = "test"

        val mysqlContainer = KtMySQLContainer()
                .withExposedPorts(3306)
                .withDatabaseName(TEST_DATABASE_NAME)
                .withUsername("test_user")
                .withPassword("test_password")
                .withEnv("MYSQL_ROOT_PASSWORD", "test_password")

        fun start() {
            if (!mysqlContainer.isRunning) {
                mysqlContainer.start()
            }
        }

        fun stop() {
            if (!mysqlContainer.isRunning) {
                mysqlContainer.start()
            }
        }

        fun getMySQLConnectionUrl(): String {
            return mysqlContainer.jdbcUrl
        }
    }

    @Before
    fun setUp() {
        start()
    }

    @After
    fun tearDown() {
        stop()
    }


    @Test
    fun printMySQLConnectionUrl() {
        println(getMySQLConnectionUrl())
    }


    class KtMySQLContainer(imageName: String) : MySQLContainer<KtMySQLContainer>(imageName) {
        constructor() : this("mysql:5.7.27")
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    resolution/waiting-for-infoWaiting for more information of the issue author or another 3rd party.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions