commit d4a41ce0aa59b7b599c927c1d1d507cbb075a38d
parent a878a3350d90c7b34f7b734a63f89dec469fb528
Author: MS <ms@taler.net>
Date: Thu, 10 Dec 2020 17:37:03 +0100
move (unit) test DB under /tmp
Diffstat:
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/nexus/src/test/kotlin/DBTest.kt b/nexus/src/test/kotlin/DBTest.kt
@@ -11,13 +11,14 @@ import java.io.File
* Cleans up the DB file afterwards.
*/
fun withTestDatabase(f: () -> Unit) {
- val dbfile = "nexus-test.sqlite3"
+ val dbfile = "jdbc:sqlite:/tmp/nexus-test.sqlite3"
File(dbfile).also {
if (it.exists()) {
it.delete()
}
}
Database.connect("jdbc:sqlite:$dbfile")
+ dbDropTables(dbfile)
try {
f()
}
diff --git a/sandbox/src/test/kotlin/DBTest.kt b/sandbox/src/test/kotlin/DBTest.kt
@@ -23,6 +23,7 @@ import org.jetbrains.exposed.sql.transactions.transaction
import org.junit.Test
import tech.libeufin.sandbox.BankAccountTransactionsTable
import tech.libeufin.sandbox.BankAccountsTable
+import tech.libeufin.sandbox.dbDropTables
import tech.libeufin.util.millis
import tech.libeufin.util.parseDashedDate
import java.io.File
@@ -33,13 +34,14 @@ import java.time.LocalDateTime
* Cleans up the DB file afterwards.
*/
fun withTestDatabase(f: () -> Unit) {
- val dbfile = "jdbc:sqlite:nexus-test.sqlite3"
+ val dbfile = "jdbc:sqlite:/tmp/nexus-test.sqlite3"
File(dbfile).also {
if (it.exists()) {
it.delete()
}
}
Database.connect("$dbfile")
+ dbDropTables(dbfile)
try {
f()
}