diff --git a/src/main/kotlin/io/kotest/extensions/testcontainers/JdbcDatabaseContainerExtension.kt b/src/main/kotlin/io/kotest/extensions/testcontainers/JdbcDatabaseContainerExtension.kt index b0755ef..36d168c 100644 --- a/src/main/kotlin/io/kotest/extensions/testcontainers/JdbcDatabaseContainerExtension.kt +++ b/src/main/kotlin/io/kotest/extensions/testcontainers/JdbcDatabaseContainerExtension.kt @@ -93,15 +93,15 @@ class JdbcDatabaseContainerExtension( } override suspend fun beforeTest(testCase: TestCase) { - beforeTest(testCase, dataSource ?: error("Datasource not initialized")) + beforeTest.invoke(testCase, dataSource ?: error("Datasource not initialized")) } override suspend fun afterTest(testCase: TestCase, result: TestResult) { - afterTest(testCase, dataSource ?: error("Datasource not initialized")) + afterTest.invoke(testCase, dataSource ?: error("Datasource not initialized")) } override suspend fun beforeSpec(spec: Spec) { - beforeSpec(spec) + beforeSpec.invoke(spec) } override suspend fun afterSpec(spec: Spec) { diff --git a/src/test/kotlin/io/kotest/extensions/testcontainers/SharedJdbcDatabaseContainerExtensionTest.kt b/src/test/kotlin/io/kotest/extensions/testcontainers/SharedJdbcDatabaseContainerExtensionTest.kt index d0ba556..f861d04 100644 --- a/src/test/kotlin/io/kotest/extensions/testcontainers/SharedJdbcDatabaseContainerExtensionTest.kt +++ b/src/test/kotlin/io/kotest/extensions/testcontainers/SharedJdbcDatabaseContainerExtensionTest.kt @@ -14,15 +14,15 @@ private val mysql = MySQLContainer("mysql:8.0.26").apply { withUrlParam("zeroDateTimeBehavior", "convertToNull") } -private val ext = SharedJdbcDatabaseContainerExtension(mysql) { - maximumPoolSize = 8 - minimumIdle = 4 -} +private val ext = JdbcDatabaseContainerExtension(mysql) class SharedJdbcTestContainerExtensionSpecTest1 : FunSpec() { init { - val ds = install(ext) + val ds = install(ext) { + maximumPoolSize = 8 + minimumIdle = 4 + } test("should initialize once per module") { ds.connection.use {