Skip to content
This repository was archived by the owner on Feb 16, 2025. It is now read-only.

Commit 6ef6af8

Browse files
authored
🚑️ Remove accidental StackOverflow on beforeSpec (#97)
1 parent 223a2c2 commit 6ef6af8

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/main/kotlin/io/kotest/extensions/testcontainers/JdbcDatabaseContainerExtension.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ class JdbcDatabaseContainerExtension(
9393
}
9494

9595
override suspend fun beforeTest(testCase: TestCase) {
96-
beforeTest(testCase, dataSource ?: error("Datasource not initialized"))
96+
beforeTest.invoke(testCase, dataSource ?: error("Datasource not initialized"))
9797
}
9898

9999
override suspend fun afterTest(testCase: TestCase, result: TestResult) {
100-
afterTest(testCase, dataSource ?: error("Datasource not initialized"))
100+
afterTest.invoke(testCase, dataSource ?: error("Datasource not initialized"))
101101
}
102102

103103
override suspend fun beforeSpec(spec: Spec) {
104-
beforeSpec(spec)
104+
beforeSpec.invoke(spec)
105105
}
106106

107107
override suspend fun afterSpec(spec: Spec) {

src/test/kotlin/io/kotest/extensions/testcontainers/SharedJdbcDatabaseContainerExtensionTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ private val mysql = MySQLContainer<Nothing>("mysql:8.0.26").apply {
1414
withUrlParam("zeroDateTimeBehavior", "convertToNull")
1515
}
1616

17-
private val ext = SharedJdbcDatabaseContainerExtension(mysql) {
18-
maximumPoolSize = 8
19-
minimumIdle = 4
20-
}
17+
private val ext = JdbcDatabaseContainerExtension(mysql)
2118

2219
class SharedJdbcTestContainerExtensionSpecTest1 : FunSpec() {
2320
init {
2421

25-
val ds = install(ext)
22+
val ds = install(ext) {
23+
maximumPoolSize = 8
24+
minimumIdle = 4
25+
}
2626

2727
test("should initialize once per module") {
2828
ds.connection.use {

0 commit comments

Comments
 (0)