Add DbManagement tests for Oracle (#2186)

This commit is contained in:
Ben Carman 2020-10-14 08:04:00 -05:00 committed by GitHub
parent ddea46545f
commit f628c265ae
2 changed files with 27 additions and 2 deletions

View File

@ -101,7 +101,7 @@ class DbManagementTest extends BitcoinSAsyncTest with EmbeddedPg {
val expected = 2
assert(result == expected)
val flywayInfo = nodeDbManagement.info()
//+1 for << Flyway Schema Creation >>
assert(flywayInfo.applied().length == expected)
assert(flywayInfo.pending().length == 0)
case PostgreSQL =>
@ -114,4 +114,28 @@ class DbManagementTest extends BitcoinSAsyncTest with EmbeddedPg {
assert(flywayInfo.pending().length == 0)
}
}
it must "run migrations for oracle db" in {
val oracleAppConfig =
DLCOracleAppConfig(BitcoinSTestAppConfig.tmpDir(),
dbConfig(ProjectType.Oracle))
val result = oracleAppConfig.migrate()
oracleAppConfig.driver match {
case SQLite =>
val expected = 1
assert(result == expected)
val flywayInfo = oracleAppConfig.info()
assert(flywayInfo.applied().length == expected)
assert(flywayInfo.pending().length == 0)
case PostgreSQL =>
val expected = 1
assert(result == expected)
val flywayInfo = oracleAppConfig.info()
//+1 for << Flyway Schema Creation >>
assert(flywayInfo.applied().length == expected + 1)
assert(flywayInfo.pending().length == 0)
}
}
}

View File

@ -99,9 +99,10 @@ object BitcoinSTestAppConfig {
case object Wallet extends ProjectType
case object Node extends ProjectType
case object Chain extends ProjectType
case object Oracle extends ProjectType
case object Test extends ProjectType
val all = List(Wallet, Node, Chain, Test)
val all = List(Wallet, Node, Chain, Oracle, Test)
}
/** Generates a Typesafe config with DBs set to memory