1
0
mirror of https://github.com/pcvolkmer/etl-processor.git synced 2025-04-20 01:36:50 +00:00

Keep database testcontainer alive until all tests are done

This commit is contained in:
Paul-Christian Volkmer 2023-08-08 14:58:10 +02:00
parent bcc23f6b14
commit 4051b5094c

View File

@ -28,7 +28,7 @@ abstract class AbstractTestcontainerTest {
companion object { companion object {
@Container @Container
val dbContainer = PostgreSQLContainer("postgres:10-alpine") val dbContainer = CustomPostgreSQLContainer("postgres:10-alpine")
.withDatabaseName("test") .withDatabaseName("test")
.withUsername("test") .withUsername("test")
.withPassword("test") ?: throw RuntimeException("Failed to create testcontainer!") .withPassword("test") ?: throw RuntimeException("Failed to create testcontainer!")
@ -43,3 +43,9 @@ abstract class AbstractTestcontainerTest {
} }
} }
class CustomPostgreSQLContainer(dockerImageName: String) : PostgreSQLContainer<CustomPostgreSQLContainer>(dockerImageName) {
override fun stop() {
// Keep Testcontainer alive until JVM destroys it
}
}