connection to postgresql

This commit is contained in:
2025-03-27 03:10:42 +01:00
parent 3b9616aa67
commit 2ebd293900
6 changed files with 96 additions and 7 deletions

View File

@@ -0,0 +1,37 @@
package eventDemo.adapter.infrastructureLayer
import eventDemo.configuration.configure
import io.kotest.core.NamedTag
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.equals.shouldBeEqual
import io.ktor.server.testing.testApplication
import org.koin.core.context.stopKoin
import org.koin.ktor.ext.inject
import javax.sql.DataSource
class PostgresqlTest :
FunSpec({
tags(NamedTag("postgresql"))
test("test connection with postgresql") {
testApplication {
application {
stopKoin()
configure()
val datasource by inject<DataSource>()
datasource.connection.use { connection ->
connection
.prepareStatement(
"""
select 1;
""".trimIndent(),
).execute()
.let {
it shouldBeEqual true
}
}
}
}
}
})