Simplify Lokksmith integration
This commit is contained in:
@@ -15,9 +15,11 @@ import io.ktor.server.routing.routing
|
||||
import io.ktor.server.testing.testApplication
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.flywaydb.core.Flyway
|
||||
import org.junit.AfterClass
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.jupiter.api.AfterAll
|
||||
import org.junit.jupiter.api.BeforeAll
|
||||
import org.testcontainers.containers.PostgreSQLContainer
|
||||
import org.testcontainers.junit.jupiter.Container
|
||||
import org.testcontainers.junit.jupiter.Testcontainers
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNotEquals
|
||||
@@ -34,16 +36,18 @@ import org.jetbrains.exposed.sql.Database as ExposedDatabase
|
||||
* process before any test executes; Exposed is connected through Hikari to
|
||||
* the container.
|
||||
*/
|
||||
@Testcontainers
|
||||
class MeRouteTest {
|
||||
companion object {
|
||||
@Container
|
||||
@JvmStatic
|
||||
private val postgres = PostgreSQLContainer("postgres:16")
|
||||
private lateinit var dataSource: HikariDataSource
|
||||
private val json = Json { ignoreUnknownKeys = true }
|
||||
|
||||
@JvmStatic
|
||||
@BeforeClass
|
||||
@BeforeAll
|
||||
fun setUpClass() {
|
||||
postgres.start()
|
||||
Flyway
|
||||
.configure()
|
||||
.dataSource(postgres.jdbcUrl, postgres.username, postgres.password)
|
||||
@@ -65,10 +69,9 @@ class MeRouteTest {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@AfterClass
|
||||
@AfterAll
|
||||
fun tearDownClass() {
|
||||
dataSource.close()
|
||||
postgres.stop()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user