gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated (826d4b4 -> 7cd27e9)


From: gnunet
Subject: [libeufin] branch master updated (826d4b4 -> 7cd27e9)
Date: Thu, 10 Dec 2020 15:54:46 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a change to branch master
in repository libeufin.

    from 826d4b4  rename DB table
     new bbe99c4  Testing harness.
     new 7cd27e9  db connection string: caller gives all parts

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 integration-tests/tests.py                         | 15 +++++++------
 integration-tests/util.py                          | 26 +++++++++++++---------
 nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt    |  8 ++-----
 nexus/src/test/kotlin/DBTest.kt                    |  2 +-
 .../src/main/kotlin/tech/libeufin/sandbox/DB.kt    |  8 ++-----
 sandbox/src/test/kotlin/DBTest.kt                  |  9 ++------
 6 files changed, 31 insertions(+), 37 deletions(-)

diff --git a/integration-tests/tests.py b/integration-tests/tests.py
index 011a39b..9ffaf6a 100755
--- a/integration-tests/tests.py
+++ b/integration-tests/tests.py
@@ -10,10 +10,9 @@ from util import (
     startNexus,
     startSandbox,
     assertResponse,
-    flushTablesSandbox,
-    flushTablesNexus,
     makeNexusSuperuser,
-    removeStaleTables
+    dropSandboxTables,
+    dropNexusTables
 )
 
 # Base URLs
@@ -134,17 +133,19 @@ def prepareNexus():
         )
     )
 
-removeStaleTables(DB)
-startNexus(DB)
+dropSandboxTables(DB)
 startSandbox(DB)
+dropNexusTables(DB)
+startNexus(DB)
 
 def setup_function():
     prepareSandbox()
     prepareNexus()
 
+
 def teardown_function():
-  flushTablesNexus(DB)
-  flushTablesSandbox(DB)
+  dropSandboxTables(DB)
+  dropNexusTables(DB)
 
 
 def test_env():
diff --git a/integration-tests/util.py b/integration-tests/util.py
index 6e96c45..a4c053d 100644
--- a/integration-tests/util.py
+++ b/integration-tests/util.py
@@ -59,19 +59,25 @@ def makeNexusSuperuser(dbName):
         f"--args=superuser admin --password x --db-name={dbName}",
     ])
 
-def drop_public_schema(dbName):
+def dropSandboxTables(dbName):
     check_call([
-        "psql",
-        "-d", dbName, "-q",
-        "-h", "127.0.0.1", "-p", "5433",
-        "-U", "libeufin",
-        "-c", "DROP SCHEMA public CASCADE; CREATE SCHEMA public;"
+        "../gradlew",
+        "-q", "--console=plain",
+        "-p", "..",
+        "sandbox:run",
+        f"--args=drop-tables --db-name={dbName}",
+    ])
+
+
+def dropNexusTables(dbName):
+    check_call([
+        "../gradlew",
+        "-q", "--console=plain",
+        "-p", "..",
+        "nexus:run",
+        f"--args=drop-tables --db-name={dbName}",
     ])
-def flushTablesSandbox(dbName):
-    drop_public_schema(dbName)
 
-def flushTablesNexus(dbName):
-    drop_public_schema(dbName)
 
 def startSandbox(dbName):
     check_call(["../gradlew", "-q", "--console=plain", "-p", "..", 
"sandbox:assemble"])
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index 6b939ad..4419b40 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -383,12 +383,8 @@ class NexusScheduledTaskEntity(id: EntityID<Int>) : 
IntEntity(id) {
     var prevScheduledExecutionSec by 
NexusScheduledTasksTable.prevScheduledExecutionSec
 }
 
-fun dbCreateTables(dbName: String) {
-    Database.connect(
-        "jdbc:postgresql://127.0.0.1:5433/${dbName}",
-        "org.postgresql.Driver",
-        user = "libeufin"
-    )
+fun dbCreateTables(dbConnectionString: String) {
+    Database.connect("$dbConnectionString")
     TransactionManager.manager.defaultIsolationLevel = 
Connection.TRANSACTION_SERIALIZABLE
     transaction {
         addLogger(StdOutSqlLogger)
diff --git a/nexus/src/test/kotlin/DBTest.kt b/nexus/src/test/kotlin/DBTest.kt
index 13bbf5d..8ca5956 100644
--- a/nexus/src/test/kotlin/DBTest.kt
+++ b/nexus/src/test/kotlin/DBTest.kt
@@ -17,7 +17,7 @@ fun withTestDatabase(f: () -> Unit) {
             it.delete()
         }
     }
-    Database.connect("jdbc:sqlite:$dbfile", "org.sqlite.JDBC")
+    Database.connect("jdbc:sqlite:$dbfile")
     try {
         f()
     }
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
index c7c1c7d..525383d 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
@@ -301,12 +301,8 @@ object BankAccountReportsTable : IntIdTable() {
     val bankAccount = reference("bankAccount", BankAccountsTable)
 }
 
-fun dbCreateTables(dbName: String) {
-    Database.connect(
-        "jdbc:postgresql://127.0.0.1:5433/${dbName}",
-        "org.postgresql.Driver",
-        user = "libeufin"
-    )
+fun dbCreateTables(dbConnectionString: String) {
+    Database.connect("${dbConnectionString}")
     TransactionManager.manager.defaultIsolationLevel = 
Connection.TRANSACTION_SERIALIZABLE
     transaction {
         addLogger(StdOutSqlLogger)
diff --git a/sandbox/src/test/kotlin/DBTest.kt 
b/sandbox/src/test/kotlin/DBTest.kt
index b529936..e333e87 100644
--- a/sandbox/src/test/kotlin/DBTest.kt
+++ b/sandbox/src/test/kotlin/DBTest.kt
@@ -19,18 +19,13 @@
 
 import org.jetbrains.exposed.dao.id.EntityID
 import org.jetbrains.exposed.sql.*
-import org.jetbrains.exposed.sql.transactions.TransactionManager
 import org.jetbrains.exposed.sql.transactions.transaction
 import org.junit.Test
 import tech.libeufin.sandbox.BankAccountTransactionsTable
-import tech.libeufin.sandbox.BankAccountTransactionsTable.msgId
-import tech.libeufin.sandbox.BankAccountTransactionsTable.pmtInfId
 import tech.libeufin.sandbox.BankAccountsTable
 import tech.libeufin.util.millis
 import tech.libeufin.util.parseDashedDate
 import java.io.File
-import java.sql.Connection
-import java.time.Instant
 import java.time.LocalDateTime
 
 /**
@@ -38,13 +33,13 @@ import java.time.LocalDateTime
  * Cleans up the DB file afterwards.
  */
 fun withTestDatabase(f: () -> Unit) {
-    val dbfile = "nexus-test.sqlite3"
+    val dbfile = "jdbc:sqlite:nexus-test.sqlite3"
     File(dbfile).also {
         if (it.exists()) {
             it.delete()
         }
     }
-    Database.connect("jdbc:sqlite:$dbfile", "org.sqlite.JDBC")
+    Database.connect("$dbfile")
     try {
         f()
     }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]