Simplify Lokksmith integration

This commit is contained in:
2026-04-30 22:27:37 +02:00
parent e0af5f4053
commit 95bbeb57d2
39 changed files with 325 additions and 740 deletions

View File

@@ -17,6 +17,10 @@ kotlin {
}
}
tasks.test {
useJUnitPlatform()
}
application {
mainClass.set("dev.ulfrx.recipe.ApplicationKt")
@@ -36,7 +40,6 @@ dependencies {
implementation(libs.postgresql)
implementation(projects.shared)
// Phase 2: Ktor auth + JWT validation + observability (D-21..D-23).
implementation(libs.ktor.serverAuth)
implementation(libs.ktor.serverAuthJwt)
implementation(libs.ktor.serverCallLogging)
@@ -49,10 +52,8 @@ dependencies {
implementation(libs.hikari)
testImplementation(libs.ktor.serverTestHost)
testImplementation(libs.kotlin.testJunit)
testImplementation(libs.kotlin.testJunit5)
// Phase 2: Testcontainers for JIT user provisioning + JWT auth integration tests
// (AUTH-03, AUTH-06). Wired here so Plan 02-02 only needs to write tests.
testImplementation(libs.testcontainers.postgresql)
testImplementation(libs.testcontainers.junit.jupiter)
}

View File

@@ -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()
}
}