Clean config in test
This commit is contained in:
@@ -7,9 +7,9 @@ object Configuration {
|
|||||||
private var config = ConfigFactory.load()
|
private var config = ConfigFactory.load()
|
||||||
|
|
||||||
object Sql {
|
object Sql {
|
||||||
val migrationFiles: URI = this::class.java.getResource("/sql/migrations").toURI()
|
val migrationFiles: URI = this::class.java.getResource("/sql/migrations")?.toURI() ?: error("No migrations found")
|
||||||
val functionFiles: URI = this::class.java.getResource("/sql/functions").toURI()
|
val functionFiles: URI = this::class.java.getResource("/sql/functions")?.toURI() ?: error("No sql function found")
|
||||||
val fixtureFiles: URI = this::class.java.getResource("/sql/fixtures").toURI()
|
val fixtureFiles: URI = this::class.java.getResource("/sql/fixtures")?.toURI() ?: error("No sql fixture found")
|
||||||
}
|
}
|
||||||
object Database {
|
object Database {
|
||||||
val host: String = config.getString("db.host")
|
val host: String = config.getString("db.host")
|
||||||
|
|||||||
@@ -32,10 +32,6 @@ class CucumberTest : En, KoinTest {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
if (!unitialized) {
|
if (!unitialized) {
|
||||||
Configuration.Database.database = "test"
|
|
||||||
Configuration.Database.username = "test"
|
|
||||||
Configuration.Database.password = "test"
|
|
||||||
|
|
||||||
withTestApplication({ module(CUCUMBER) }) {
|
withTestApplication({ module(CUCUMBER) }) {
|
||||||
migrations()
|
migrations()
|
||||||
}
|
}
|
||||||
@@ -43,9 +39,6 @@ class CucumberTest : En, KoinTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Before(-1) { _: Scenario ->
|
Before(-1) { _: Scenario ->
|
||||||
Configuration.Database.database = "test"
|
|
||||||
Configuration.Database.username = "test"
|
|
||||||
Configuration.Database.password = "test"
|
|
||||||
ktorContext.start()
|
ktorContext.start()
|
||||||
//language=PostgreSQL
|
//language=PostgreSQL
|
||||||
get<Connection>().sendQuery("start transaction;", listOf())
|
get<Connection>().sendQuery("start transaction;", listOf())
|
||||||
@@ -59,9 +52,6 @@ class CucumberTest : En, KoinTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun migrations() {
|
private fun migrations() {
|
||||||
Configuration.Database.database = "test"
|
|
||||||
Configuration.Database.username = "test"
|
|
||||||
Configuration.Database.password = "test"
|
|
||||||
val migrations: Migrations = get()
|
val migrations: Migrations = get()
|
||||||
migrations.forceAllDown()
|
migrations.forceAllDown()
|
||||||
migrations.run()
|
migrations.run()
|
||||||
|
|||||||
Reference in New Issue
Block a user