Skip to content

Commit

Permalink
Merge pull request #11 from Sphereon-Opensource/feature/OIDF-32-test-…
Browse files Browse the repository at this point in the history
…container

Added Test container
  • Loading branch information
nklomp authored Jul 30, 2024
2 parents 40fbfef + 2c633c9 commit dac6b6a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ springboot-data-jdbc = { group = "org.springframework.boot", name = "spring-boot
springboot-devtools = { group = "org.springframework.boot", name = "spring-boot-devtools" }
springboot-test = { group = "org.springframework.boot", name = "spring-boot-starter-test" }
postgres = { module = "org.postgresql:postgresql" }
springboot-testcontainer = { group = "org.springframework.boot", name = "spring-boot-testcontainers"}
testcontainer-postgres = { group = "org.testcontainers", name = "postgresql"}
testcontainer-junit = { group = "org.testcontainers", name = "junit-jupiter"}

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
Expand Down
3 changes: 3 additions & 0 deletions modules/admin-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ dependencies {
implementation(libs.springboot.data.jdbc)
implementation(libs.kotlin.reflect)
testImplementation(libs.springboot.test)
testImplementation(libs.testcontainer.junit)
testImplementation(libs.springboot.testcontainer)
testImplementation(libs.testcontainer.postgres)
runtimeOnly(libs.postgres)
runtimeOnly(libs.springboot.devtools)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.sphereon.oid.fed.server.admin

import org.junit.jupiter.api.Test
import org.testcontainers.containers.PostgreSQLContainer
import org.testcontainers.junit.jupiter.Container
import org.testcontainers.junit.jupiter.Testcontainers

@Testcontainers
class DatabaseTest {

@Container
val postgres: PostgreSQLContainer<*> = PostgreSQLContainer("postgres:14")

@Test
fun `test database connection`() {
assert(postgres.isRunning)
}
}

0 comments on commit dac6b6a

Please sign in to comment.