Skip to content

Commit

Permalink
Added Test container
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmathew committed Jul 10, 2024
1 parent 1639346 commit 2c633c9
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 @@ -37,6 +37,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 @@ -21,6 +21,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 2c633c9

Please sign in to comment.