Skip to content
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

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

Closed
ryukato opened this issue Aug 27, 2019 · 6 comments
Closed

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

ryukato opened this issue Aug 27, 2019 · 6 comments
Labels
resolution/waiting-for-info Waiting for more information of the issue author or another 3rd party.

Comments

@ryukato
Copy link
Contributor

ryukato commented Aug 27, 2019

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")
    }
}
@bsideup
Copy link
Member

bsideup commented Aug 27, 2019

Hi @ryukato,

Could you please share your Testcontainers version?

@bsideup bsideup added the resolution/waiting-for-info Waiting for more information of the issue author or another 3rd party. label Aug 27, 2019
@ryukato
Copy link
Contributor Author

ryukato commented Aug 27, 2019

I updated issue description with the version.

@bsideup
Copy link
Member

bsideup commented Aug 27, 2019

@ryukato please try the latest version, @rnorth implemented better handling of drivers

@ryukato
Copy link
Contributor Author

ryukato commented Aug 27, 2019

Ok thanks I will check with the latest one.

@rnorth
Copy link
Member

rnorth commented Aug 27, 2019

Yep, #1434, (released in 1.12.0) should improve this!

@ryukato
Copy link
Contributor Author

ryukato commented Aug 27, 2019

Good! it is working beautifully. :) I will close this, Thanks again. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution/waiting-for-info Waiting for more information of the issue author or another 3rd party.
Projects
None yet
Development

No branches or pull requests

3 participants