[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: Testing the PostgreSQL connection stri
From: |
gnunet |
Subject: |
[libeufin] branch master updated: Testing the PostgreSQL connection string. |
Date: |
Thu, 10 Dec 2020 17:16:55 +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 27a8fa9 Testing the PostgreSQL connection string.
27a8fa9 is described below
commit 27a8fa91a81b3f8930dfe3145f8d930bb03dc545
Author: MS <ms@taler.net>
AuthorDate: Thu Dec 10 17:16:24 2020 +0100
Testing the PostgreSQL connection string.
---
integration-tests/tests.py | 2 +-
integration-tests/util.py | 44 ++++++++++------------
nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 9 +++--
.../src/main/kotlin/tech/libeufin/sandbox/Main.kt | 4 +-
util/src/main/kotlin/Config.kt | 2 +
5 files changed, 29 insertions(+), 32 deletions(-)
diff --git a/integration-tests/tests.py b/integration-tests/tests.py
index 9ffaf6a..ff3bcbb 100755
--- a/integration-tests/tests.py
+++ b/integration-tests/tests.py
@@ -20,7 +20,7 @@ S = "http://localhost:5000"
N = "http://localhost:5001"
# Database
-DB = "libeufintestdb"
+DB = "jdbc:postgresql://127.0.0.1:5433/libeufintestdb?user=libeufin"
# Nexus user details
NEXUS_USERNAME = "person"
diff --git a/integration-tests/util.py b/integration-tests/util.py
index 83b63bf..f9689aa 100644
--- a/integration-tests/util.py
+++ b/integration-tests/util.py
@@ -46,40 +46,36 @@ def kill(name, s):
s.terminate()
s.wait()
-def removeStaleTables(dbName):
- flushTablesNexus(dbName)
- flushTablesSandbox(dbName)
-
-def makeNexusSuperuser(dbName):
+def makeNexusSuperuser(dbConnString):
check_call([
"../gradlew",
"-q", "--console=plain",
"-p", "..",
"nexus:run",
- f"--args=superuser admin --password x --db-name={dbName}",
+ f"--args=superuser admin --password x --db-conn-string={dbConnString}",
])
-def dropSandboxTables(dbName):
+def dropSandboxTables(dbConnString):
check_call([
"../gradlew",
"-q", "--console=plain",
"-p", "..",
"sandbox:run",
- f"--args=drop-tables",
+ f"--args=drop-tables --db-conn-string={dbConnString}"
])
-def dropNexusTables(dbName):
+def dropNexusTables(dbConnString):
check_call([
"../gradlew",
"-q", "--console=plain",
"-p", "..",
"nexus:run",
- f"--args=drop-tables",
+ f"--args=drop-tables --db-conn-string={dbConnString}"
])
-def startSandbox(dbName):
+def startSandbox(dbConnString):
check_call(["../gradlew", "-q", "--console=plain", "-p", "..",
"sandbox:assemble"])
checkPort(5000)
sandbox = Popen([
@@ -89,10 +85,10 @@ def startSandbox(dbName):
"..",
"sandbox:run",
"--console=plain",
- "--args=serve --db-name={}".format(dbName)],
+ "--args=serve --db-conn-string={}".format(dbConnString)],
stdin=DEVNULL,
stdout=open("sandbox-stdout.log", "w"),
- stderr=open("sandbox-stderr.log", "w"),
+ stderr=open("sandbox-stderr.log", "w")
)
atexit.register(lambda: kill("sandbox", sandbox))
for i in range(10):
@@ -109,24 +105,22 @@ def startSandbox(dbName):
break
-def startNexus(dbName):
+def startNexus(dbConnString):
check_call(
["../gradlew", "-q", "--console=plain", "-p", "..", "nexus:assemble",]
)
checkPort(5001)
- nexus = Popen(
- [
- "../gradlew",
- "-q",
- "-p",
- "..",
- "nexus:run",
- "--console=plain",
- "--args=serve --db-name={}".format(dbName),
- ],
+ nexus = Popen([
+ "../gradlew",
+ "-q",
+ "-p",
+ "..",
+ "nexus:run",
+ "--console=plain",
+ "--args=serve --db-conn-string={}".format(dbConnString)],
stdin=DEVNULL,
stdout=open("nexus-stdout.log", "w"),
- stderr=open("nexus-stderr.log", "w"),
+ stderr=open("nexus-stderr.log", "w")
)
atexit.register(lambda: kill("nexus", nexus))
for i in range(80):
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index 0ef3602..5944c55 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -35,6 +35,7 @@ import tech.libeufin.nexus.server.serverMain
import tech.libeufin.util.CryptoUtil.hashpw
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import tech.libeufin.nexus.iso20022.parseCamtMessage
+import tech.libeufin.util.DEFAULT_DB_CONNECTION
import tech.libeufin.util.XMLUtil
import tech.libeufin.util.setLogLevel
import java.io.File
@@ -51,7 +52,7 @@ class Serve : CliktCommand("Run nexus HTTP server") {
helpFormatter = CliktHelpFormatter(showDefaultValues = true)
}
}
- private val dbConnString by option().default("jdbc:sqlite://libeufindb")
+ private val dbConnString by option().default(DEFAULT_DB_CONNECTION)
private val host by option().default("127.0.0.1")
private val logLevel by option()
override fun run() {
@@ -72,18 +73,18 @@ class ParseCamt : CliktCommand("Parse a camt file") {
}
class DropTables : CliktCommand("Drop all the tables from the database") {
- private val dbConnString by option().default("jdbc:sqlite://libeufindb")
+ private val dbConnString by option().default(DEFAULT_DB_CONNECTION)
override fun run() {
dbDropTables(dbConnString)
}
}
class Superuser : CliktCommand("Add superuser or change pw") {
- private val dbName by option().default("jdbc:sqlite://libeufindb")
+ private val dbConnString by option().default(DEFAULT_DB_CONNECTION)
private val username by argument()
private val password by option().prompt(requireConfirmation = true,
hideInput = true)
override fun run() {
- dbCreateTables(dbName)
+ dbCreateTables(dbConnString)
transaction {
val hashedPw = hashpw(password)
val user = NexusUserEntity.findById(username)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index c93cab9..6b6788d 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -91,14 +91,14 @@ class SandboxCommand : CliktCommand() {
}
class DropTables : CliktCommand("Drop all the tables from the database") {
- private val dbConnString by option().default("jdbc:sqlite://libeufindb")
+ private val dbConnString by option().default(DEFAULT_DB_CONNECTION)
override fun run() {
dbDropTables(dbConnString)
}
}
class Serve : CliktCommand("Run sandbox HTTP server") {
- private val dbConnString by option().default("jdbc:sqlite://libeufindb")
+ private val dbConnString by option().default(DEFAULT_DB_CONNECTION)
private val logLevel by option()
override fun run() {
LOGGER = LoggerFactory.getLogger("tech.libeufin.sandbox")
diff --git a/util/src/main/kotlin/Config.kt b/util/src/main/kotlin/Config.kt
index 607ac67..c065fa6 100644
--- a/util/src/main/kotlin/Config.kt
+++ b/util/src/main/kotlin/Config.kt
@@ -6,6 +6,8 @@ import ch.qos.logback.classic.util.ContextInitializer
import ch.qos.logback.core.util.Loader
import org.slf4j.LoggerFactory
+val DEFAULT_DB_CONNECTION = "jdbc:sqlite:/tmp/libeufindb"
+
/**
* Set system properties to wanted values, and load logback configuration
after.
* While it can set any system property, it is used only to set the log file
name.
--
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: Testing the PostgreSQL connection string.,
gnunet <=