[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: Migrating to Postgresql.
From: |
gnunet |
Subject: |
[libeufin] branch master updated: Migrating to Postgresql. |
Date: |
Tue, 08 Dec 2020 09:40:03 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new ee29004 Migrating to Postgresql.
ee29004 is described below
commit ee29004c64cf2ccf3640857b8f71139713a814bc
Author: MS <ms@taler.net>
AuthorDate: Tue Dec 8 09:39:49 2020 +0100
Migrating to Postgresql.
---
build-system/taler-build-scripts | 2 +-
integration-tests/tests.py | 24 +++-----
integration-tests/util.py | 71 ++++++++++------------
nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt | 2 +-
sandbox/build.gradle | 1 +
.../src/main/kotlin/tech/libeufin/sandbox/DB.kt | 2 +-
6 files changed, 45 insertions(+), 57 deletions(-)
diff --git a/build-system/taler-build-scripts b/build-system/taler-build-scripts
index 47f14fc..e3362ab 160000
--- a/build-system/taler-build-scripts
+++ b/build-system/taler-build-scripts
@@ -1 +1 @@
-Subproject commit 47f14fcf1d03d9dad1bae59987488ea05ecd307b
+Subproject commit e3362ab5efd9c4d9ae7fa4de7420f55d09f26226
diff --git a/integration-tests/tests.py b/integration-tests/tests.py
index 9a5f3f9..703711a 100755
--- a/integration-tests/tests.py
+++ b/integration-tests/tests.py
@@ -13,16 +13,15 @@ from util import (
flushTablesSandbox,
flushTablesNexus,
makeNexusSuperuser,
- removeStaleDatabase
+ removeStaleTables
)
# Base URLs
S = "http://localhost:5000"
N = "http://localhost:5001"
-# Databases
-NEXUS_DB="/tmp/test-nexus.sqlite3"
-SANDBOX_DB="/tmp/test-sandbox.sqlite3"
+# Database
+DB = "libeufintestdb"
# Nexus user details
NEXUS_USERNAME = "person"
@@ -80,7 +79,7 @@ def prepareSandbox():
)
def prepareNexus():
- makeNexusSuperuser(NEXUS_DB)
+ makeNexusSuperuser(DB)
# make a new nexus user.
assertResponse(
post(
@@ -135,19 +134,17 @@ def prepareNexus():
)
)
-removeStaleDatabase(NEXUS_DB)
-startNexus(NEXUS_DB)
-
-removeStaleDatabase(SANDBOX_DB)
-startSandbox(SANDBOX_DB)
+removeStaleTables(DB)
+startNexus(DB)
+startSandbox(DB)
def setup_function():
prepareSandbox()
prepareNexus()
def teardown_function():
- flushTablesNexus(NEXUS_DB)
- flushTablesSandbox(SANDBOX_DB)
+ flushTablesNexus(DB)
+ flushTablesSandbox(DB)
def test_env():
@@ -314,8 +311,7 @@ def test_payment_double_submission():
)
)
check_call([
- "sqlite3",
- NEXUS_DB,
+ "psql", "-d", DB,
f"UPDATE PaymentInitiations SET submitted = false WHERE id =
'{PAYMENT_UUID}'"
])
# Submit payment the _second_ time, expecting 500 from Nexus.
diff --git a/integration-tests/util.py b/integration-tests/util.py
index a8bda14..83a8722 100644
--- a/integration-tests/util.py
+++ b/integration-tests/util.py
@@ -46,10 +46,9 @@ def kill(name, s):
s.terminate()
s.wait()
-def removeStaleDatabase(dbName):
- db_full_path = str(Path.cwd() / dbName)
- if os.path.exists(db_full_path):
- os.remove(db_full_path)
+def removeStaleTables(dbName):
+ flushTablesNexus(dbName)
+ flushTablesSandbox(dbName)
def makeNexusSuperuser(dbName):
db_full_path = str(Path.cwd() / dbName)
@@ -66,48 +65,42 @@ def makeNexusSuperuser(dbName):
)
def flushTablesSandbox(dbName):
- db_full_path = str(Path.cwd() / dbName)
check_call(
- ["sqlite3",
- db_full_path,
- "DELETE FROM BankAccountReports",
- "DELETE FROM EbicsOrderSignatures",
- "DELETE FROM BankAccountStatements",
- "DELETE FROM EbicsSubscriberPublicKeys",
- "DELETE FROM BankAccountTransactions",
- "DELETE FROM EbicsSubscribers",
- "DELETE FROM BankAccounts",
- "DELETE FROM EbicsUploadTransactionChunks",
- "DELETE FROM EbicsDownloadTransactions",
- "DELETE FROM EbicsUploadTransactions",
- "DELETE FROM EbicsHosts"
+ ["psql", "-d", dbName,
+ "-c", "DELETE FROM BankAccountReports",
+ "-c", "DELETE FROM EbicsOrderSignatures",
+ "-c", "DELETE FROM BankAccountStatements",
+ "-c", "DELETE FROM EbicsSubscriberPublicKeys",
+ "-c", "DELETE FROM BankAccountTransactions",
+ "-c", "DELETE FROM EbicsSubscribers",
+ "-c", "DELETE FROM BankAccounts",
+ "-c", "DELETE FROM EbicsUploadTransactionChunks",
+ "-c", "DELETE FROM EbicsDownloadTransactions",
+ "-c", "DELETE FROM EbicsUploadTransactions",
+ "-c", "DELETE FROM EbicsHosts"
]
)
def flushTablesNexus(dbName):
- db_full_path = str(Path.cwd() / dbName)
check_call(
- ["sqlite3",
- db_full_path,
- "DELETE FROM EbicsSubscribers",
- "DELETE FROM NexusBankTransactions",
- "DELETE FROM TalerFacadeState",
- "DELETE FROM Facades",
- "DELETE FROM NexusScheduledTasks",
- "DELETE FROM TalerIncomingPayments",
- "DELETE FROM NexusBankAccounts",
- "DELETE FROM NexusUsers",
- "DELETE FROM TalerRequestedPayments",
- "DELETE FROM NexusBankConnections",
- "DELETE FROM OfferedBankAccounts",
- "DELETE FROM NexusBankMessages",
- "DELETE FROM PaymentInitiations"
+ ["psql", "-d", dbName,
+ "-c", "DELETE FROM EbicsSubscribers",
+ "-c", "DELETE FROM NexusBankTransactions",
+ "-c", "DELETE FROM TalerFacadeState",
+ "-c", "DELETE FROM Facades",
+ "-c", "DELETE FROM NexusScheduledTasks",
+ "-c", "DELETE FROM TalerIncomingPayments",
+ "-c", "DELETE FROM NexusBankAccounts",
+ "-c", "DELETE FROM NexusUsers",
+ "-c", "DELETE FROM TalerRequestedPayments",
+ "-c", "DELETE FROM NexusBankConnections",
+ "-c", "DELETE FROM OfferedBankAccounts",
+ "-c", "DELETE FROM NexusBankMessages",
+ "-c", "DELETE FROM PaymentInitiations"
]
)
-def startSandbox(dbName="sandbox-test.sqlite3"):
- db_full_path = str(Path.cwd() / dbName)
- check_call(["rm", "-f", db_full_path])
+def startSandbox(dbName):
check_call(["../gradlew", "-q", "-p", "..", "sandbox:assemble"])
checkPort(5000)
sandbox = Popen(
@@ -131,9 +124,7 @@ def startSandbox(dbName="sandbox-test.sqlite3"):
break
-def startNexus(dbName="nexus-test.sqlite3"):
- db_full_path = str(Path.cwd() / dbName)
- check_call(["rm", "-f", "--", db_full_path])
+def startNexus(dbName):
check_call(
["../gradlew", "-q", "-p", "..", "nexus:assemble",]
)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index 5661d29..c50a4ad 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -385,7 +385,7 @@ class NexusScheduledTaskEntity(id: EntityID<Int>) :
IntEntity(id) {
}
fun dbCreateTables(dbName: String) {
- Database.connect("jdbc:sqlite:${dbName}", "org.sqlite.JDBC")
+ Database.connect("jdbc:postgresql:${dbName}", "org.postgresql.Driver")
TransactionManager.manager.defaultIsolationLevel =
Connection.TRANSACTION_SERIALIZABLE
transaction {
addLogger(StdOutSqlLogger)
diff --git a/sandbox/build.gradle b/sandbox/build.gradle
index 66c50d4..1199150 100644
--- a/sandbox/build.gradle
+++ b/sandbox/build.gradle
@@ -54,6 +54,7 @@ dependencies {
implementation 'org.apache.santuario:xmlsec:2.1.4'
implementation group: 'org.bouncycastle', name: 'bcprov-jdk16', version:
'1.45'
implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.28.0'
+ implementation "org.postgresql:postgresql:42.2.18"
implementation group: 'org.apache.commons', name: 'commons-compress',
version: '1.20'
implementation("com.github.ajalt:clikt:2.7.0")
implementation "org.jetbrains.exposed:exposed-core:$exposed_version"
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
index 5d9a6ca..a11a3b7 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
@@ -302,7 +302,7 @@ object BankAccountReportsTable : IntIdTable() {
}
fun dbCreateTables(dbName: String) {
- Database.connect("jdbc:sqlite:${dbName}", "org.sqlite.JDBC")
+ Database.connect("jdbc:postgresql:${dbName}", "org.postgresql.Driver")
TransactionManager.manager.defaultIsolationLevel =
Connection.TRANSACTION_SERIALIZABLE
transaction {
addLogger(StdOutSqlLogger)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: Migrating to Postgresql.,
gnunet <=