commit 66a354cf67553c89d41ea9ccba322c04e74a1b7f
parent 1d85d6ecac7b6e77402d4db71035d6e69d760048
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 21 Nov 2024 13:47:28 +0100
-fix donau test
Diffstat:
12 files changed, 144 insertions(+), 102 deletions(-)
diff --git a/debian/taler-donau.install b/debian/taler-donau.install
@@ -1,39 +1,14 @@
-usr/bin/taler-donau-aggregator
-usr/bin/taler-donau-closer
-usr/bin/taler-donau-drain
-usr/bin/taler-donau-expire
-usr/bin/taler-donau-httpd
-usr/bin/taler-donau-router
-usr/bin/taler-donau-secmod-cs
-usr/bin/taler-donau-secmod-eddsa
-usr/bin/taler-donau-secmod-rsa
-usr/bin/taler-donau-transfer
-usr/bin/taler-donau-wirewatch
-usr/bin/taler-donau-wire-gateway-client
-usr/lib/*/taler/libtaler_plugin_kyclogic_*.so
-usr/lib/*/taler/libtaler_extension_*.so
-usr/share/man/man1/taler-donau-aggregator*
-usr/share/man/man1/taler-donau-closer*
-usr/share/man/man1/taler-donau-drain*
-usr/share/man/man1/taler-donau-expire*
-usr/share/man/man1/taler-donau-httpd*
-usr/share/man/man1/taler-donau-router*
-usr/share/man/man1/taler-donau-secmod-eddsa*
-usr/share/man/man1/taler-donau-secmod-rsa*
-usr/share/man/man1/taler-donau-secmod-cs*
-usr/share/man/man1/taler-donau-transfer*
-usr/share/man/man1/taler-donau-wirewatch*
-usr/share/man/man1/taler-bank*
-usr/share/man/man1/taler-donau-wire-gateway-client*
-usr/share/info/taler-bank*
-usr/share/info/taler-donau*
-usr/share/taler/config.d/*
-usr/share/taler/donau/templates/*.must
+usr/bin/donau-*
+usr/lib/*/donau/libdonau_plugin_*.so
+usr/share/man/man1/donau-*
+usr/share/info/donau*
+usr/share/donau/config.d/*
+usr/share/donau/sql/*
-# configuration files in /etc/taler
-debian/etc-taler-donau/* etc/
+# configuration files in /etc/donau
+debian/etc-donau/* etc/
# Terms of service / privacy policy templates
-usr/share/taler/terms/*.rst
+usr/share/donau/terms/*.rst
# Translations of ToS/PP
usr/share/locale/*/LC_MESSAGES/*.po
diff --git a/src/donau/.gitignore b/src/donau/.gitignore
@@ -11,3 +11,5 @@ donau-closer
donau-transfer
donau-router
donau-expire
+test_donau_httpd.conf.edited
+test_donau_httpd_home/
diff --git a/src/donau/Makefile.am b/src/donau/Makefile.am
@@ -68,7 +68,7 @@ EXTRA_DIST = \
test_donau_httpd.conf \
test_donau_unix.conf \
test_donau_httpd.get \
- test_donau_httpd.post \
donau.conf \
+ setup.sh \
$(bin_SCRIPTS) \
$(check_SCRIPTS)
diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c
@@ -432,15 +432,6 @@ handle_mhd_request (void *cls,
void **con_cls)
{
static struct DH_RequestHandler handlers[] = {
-/* /robots.txt: disallow everything */
- {
- .url = "robots.txt",
- .method = MHD_HTTP_METHOD_GET,
- // .handler.get = &DH_handler_static_response,
- .mime_type = "text/plain",
- .data = "User-agent: *\nDisallow: /\n",
- .response_code = MHD_HTTP_OK
- },
/* Terms of service */
{
.url = "terms",
@@ -464,7 +455,6 @@ handle_mhd_request (void *cls,
.url = "keys",
.method = MHD_HTTP_METHOD_GET,
.handler.get = &DH_handler_keys
- // .handler.get = &DH_keys_get_handler
},
/* GET charities */
{
@@ -879,6 +869,8 @@ do_shutdown (void *cls)
struct MHD_Daemon *mhd;
(void) cls;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Shutdown initiated\n");
mhd = TALER_MHD_daemon_stop ();
if (NULL != mhd)
{
@@ -929,6 +921,8 @@ run (void *cls,
go |= TALER_MHD_GO_FORCE_CONNECTION_CLOSE;
TALER_MHD_setup (go);
DH_cfg = config;
+ GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
+ NULL);
if (GNUNET_OK !=
donau_serve_process_config ())
@@ -966,8 +960,6 @@ run (void *cls,
return;
}
donau_curl_rc = GNUNET_CURL_gnunet_rc_create (DH_curl_ctx);
- GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
- NULL);
fh = TALER_MHD_bind (DH_cfg,
"donau",
&serve_port);
diff --git a/src/donau/setup.sh b/src/donau/setup.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+# This file is in the public domain
+
+# Script to be inlined into the main test scripts. Defines function 'setup()'
+# which wraps around 'taler-unified-setup.sh' to launch GNU Taler services.
+# Call setup() with the arguments to pass to 'taler-unified-setup'. setup()
+# will then launch GNU Taler, wait for the process to be complete before
+# returning. The script will also install an exit handler to ensure the GNU
+# Taler processes are stopped when the shell exits.
+
+set -eu
+
+unset XDG_DATA_HOME
+unset XDG_CONFIG_HOME
+
+
+# Cleanup to run whenever we exit
+function exit_cleanup()
+{
+ if [ ! -z ${SETUP_PID+x} ]
+ then
+ echo "Killing taler-unified-setup ($SETUP_PID)" >&2
+ kill -TERM "$SETUP_PID" 2> /dev/null || true
+ wait "$SETUP_PID" 2> /dev/null || true
+ fi
+}
+
+# Install cleanup handler (except for kill -9)
+trap exit_cleanup EXIT
+
+function setup()
+{
+ echo "Starting test system ..." >&2
+ # Create a named pipe in a temp directory we own.
+ FIFO_DIR=$(mktemp -p "${TMPDIR:-/tmp}" -d fifo-XXXXXX)
+ FIFO_OUT=$(echo "$FIFO_DIR/out")
+ mkfifo "$FIFO_OUT"
+ # Open pipe as FD 3 (RW) and FD 4 (RO)
+ exec 3<> "$FIFO_OUT" 4< "$FIFO_OUT"
+ rm -rf "$FIFO_DIR"
+ # We require '-W' for our termination logic to work.
+ taler-unified-setup.sh -W "$@" >&3 &
+ SETUP_PID=$!
+ # Close FD3
+ exec 3>&-
+ sed -u '/<<READY>>/ q' <&4
+ # Close FD4
+ exec 4>&-
+ echo "Test system ready" >&2
+}
+
+# Exit, with status code "skip" (no 'real' failure)
+function exit_fail() {
+ echo "$@" >&2
+ exit 1
+}
+
+# Exit, with status code "skip" (no 'real' failure)
+function exit_skip() {
+ echo "SKIPPING: $1"
+ exit 77
+}
+
+function get_payto_uri() {
+ libeufin-bank create-account -u "$1" -p "$2" --name "$1" 2> /dev/null
+}
+
+echo -n "Checking for curl ..."
+curl --version 2> /dev/null > /dev/null || exit_skip " no curl"
+echo " OK"
+echo -n "Checking for jq ..."
+jq --version 2> /dev/null > /dev/null || exit_skip " no jq"
+echo " OK"
diff --git a/src/donau/test_donau_httpd.conf b/src/donau/test_donau_httpd.conf
@@ -1,12 +1,13 @@
[PATHS]
# Persistent data storage for the testcase
-TALER_TEST_HOME = test_donau_httpd_home/
-TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/${USER:-}/donau-system-runtime/
+DONAU_TEST_HOME = test_donau_httpd_home/
+DONAU_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/${USER:-}/donau-system-runtime/
[donau]
# Currency supported by the Donau (can only be one)
CURRENCY = EUR
CURRENCY_ROUND_UNIT = EUR:0.01
+SERVE = tcp
# Base url of the Donau
DOMAIN = "Bern"
@@ -18,7 +19,7 @@ TERMS_DIR = ../../contrib/tos
# Etag / filename for the terms of service.
TERMS_ETAG = 0
-SIGNKEY_LEGAL_DURATION = 2 years
+SIGNKEY_LEGAL_DURATION = 4 years
# Directory with our privacy policy.
PRIVACY_DIR = ../../contrib/pp
@@ -27,14 +28,14 @@ PRIVACY_DIR = ../../contrib/pp
PRIVACY_ETAG = 0
# how long is one signkey valid?
-SIGNKEY_DURATION = 4 weeks
+SIGNKEY_DURATION = 2 years
# how long do we generate denomination and signing keys
# ahead of time?
-LOOKAHEAD_SIGN = 32 weeks 1 day
+LOOKAHEAD_SIGN = 2 years
# HTTP port the donau listens to
-PORT = 8081
+PORT = 8089
# How to access our database
DB = postgres
@@ -59,7 +60,7 @@ CONFIG = "postgres:///donaucheck"
# Coins for the tests.
[coin_eur_ct_1_rsa]
value = EUR:0.01
-duration_withdraw = 7 days
+duration_withdraw = 1 year
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = EUR:0.00
@@ -71,7 +72,7 @@ rsa_keysize = 1024
[coin_eur_ct_1_cs]
value = EUR:0.01
-duration_withdraw = 7 days
+duration_withdraw = 1 year
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = EUR:0.00
@@ -82,7 +83,7 @@ CIPHER = CS
[coin_eur_ct_10_rsa]
value = EUR:0.10
-duration_withdraw = 7 days
+duration_withdraw = 1 year
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = EUR:0.01
@@ -94,7 +95,7 @@ rsa_keysize = 1024
[coin_eur_ct_10_cs]
value = EUR:0.10
-duration_withdraw = 7 days
+duration_withdraw = 1 year
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = EUR:0.01
@@ -105,7 +106,7 @@ CIPHER = CS
[coin_eur_1_rsa]
value = EUR:1
-duration_withdraw = 7 days
+duration_withdraw = 1 year
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = EUR:0.01
@@ -117,7 +118,7 @@ rsa_keysize = 1024
[coin_eur_1_cs]
value = EUR:1
-duration_withdraw = 7 days
+duration_withdraw = 1 year
duration_spend = 2 years
duration_legal = 3 years
fee_withdraw = EUR:0.01
diff --git a/src/donau/test_donau_httpd.get b/src/donau/test_donau_httpd.get
@@ -0,0 +1,27 @@
+# This file is part of TALER
+# Copyright (C) 2020 Taler Systems SA
+#
+# TALER is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Affero General Public License as published by the Free Software
+# Foundation; either version 3, or (at your option) any later version.
+#
+# TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License along with
+# TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
+#
+#
+# This is a resource file for test_taler_exchange_httpd.sh.
+# Lines starting with '#' (must be first character in line) are comments.
+#
+# Each non-comment line must contain the URL on the HTTP server.
+#
+/
+/agpl
+/seed
+/robots.txt
+/terms
+/privacy
+/wire
diff --git a/src/donau/test_donau_httpd.sh b/src/donau/test_donau_httpd.sh
@@ -28,57 +28,26 @@ set -eu
#
echo -n "Launching donau ..."
-# FIXME
-exit 77
-
-# Uncomment this line to run with valgrind...
-PREFIX="valgrind --leak-check=yes --track-fds=yes --error-exitcode=1 --log-file=valgrind.%p"
-
. setup.sh
# Setup database
setup -c "test_donau_httpd.conf" \
-D \
-# Give HTTP time to start
-for n in `seq 1 100`
-do
- echo -n "."
- sleep 0.1
- OK=1
- wget http://localhost:8080/config -o /dev/null -O /dev/null >/dev/null && break
- OK=0
-done
-if [ 1 != $OK ]
-then
- echo "Failed to launch donau"
- kill -TERM $!
- wait $!
- echo Process status: $?
- exit 77
-fi
-echo " DONE"
-
# Finally run test...
echo -n "Running tests ..."
-# We read the JSON snippets to POST from test_donau_httpd.post
-cat test_donau_httpd.post | grep -v ^\# | awk '{ print "curl -d \47" $2 "\47 http://localhost:8080" $1 }' | bash &> /dev/null
-echo -n .
# We read the JSON snippets to GET from test_donau_httpd.get
-cat test_donau_httpd.get | grep -v ^\# | awk '{ print "curl http://localhost:8080" $1 }' | bash &> /dev/null
+cat test_donau_httpd.get | grep -v ^\# | awk '{ print "curl http://localhost:8089" $1 }' | bash &> /dev/null
echo -n .
# Also try them with various headers: Language
-cat test_donau_httpd.get | grep -v ^\# | awk '{ print "curl -H \"Accept-Language: fr,en;q=0.4,de\" http://localhost:8080" $1 }' | bash &> /dev/null
+cat test_donau_httpd.get | grep -v ^\# | awk '{ print "curl -H \"Accept-Language: fr,en;q=0.4,de\" http://localhost:8089" $1 }' | bash &> /dev/null
echo -n .
# Also try them with various headers: Accept encoding (wildcard #1)
-cat test_donau_httpd.get | grep -v ^\# | awk '{ print "curl -H \"Accept: text/*\" http://localhost:8080" $1 }' | bash &> /dev/null
+cat test_donau_httpd.get | grep -v ^\# | awk '{ print "curl -H \"Accept: text/*\" http://localhost:8089" $1 }' | bash &> /dev/null
echo -n .
# Also try them with various headers: Accept encoding (wildcard #2)
-cat test_donau_httpd.get | grep -v ^\# | awk '{ print "curl -H \"Accept: */plain\" http://localhost:8080" $1 }' | bash &> /dev/null
+cat test_donau_httpd.get | grep -v ^\# | awk '{ print "curl -H \"Accept: */plain\" http://localhost:8089" $1 }' | bash &> /dev/null
echo " DONE"
-# $! is the last backgrounded process, hence the donau
-kill -TERM $!
-wait $!
-# Return status code from donau for this script
-exit $?
+exit 0
+
diff --git a/src/donaudb/Makefile.am b/src/donaudb/Makefile.am
@@ -12,7 +12,7 @@ pkgcfg_DATA = \
donaudb.conf \
donaudb-postgres.conf
-sqldir = $(prefix)/share/donau/sql/donau/
+sqldir = $(prefix)/share/donau/sql/
sqlinputs = \
donau_do_*.sql \
diff --git a/src/donaudb/donaudb-postgres.conf b/src/donaudb/donaudb-postgres.conf
@@ -3,4 +3,4 @@ CONFIG = "postgres:///donaucheck"
# Where are the SQL files to setup our tables?
# Important: this MUST end with a "/"!
-SQL_DIR = $DATADIR/sql/donau/
+SQL_DIR = $DATADIR/sql/
diff --git a/src/util/donau-secmod-eddsa.conf b/src/util/donau-secmod-eddsa.conf
@@ -23,4 +23,9 @@ SM_PRIV_KEY = ${DONAU_DATA_HOME}donau-secmod-eddsa/secmod-private-key
LOOKAHEAD_SIGN = 2 year
# Round down anchor key start date to multiples of this time.
-ANCHOR_ROUND = 1 year
-\ No newline at end of file
+ANCHOR_ROUND = 1 year
+
+
+# For how long are signing keys valid?
+DURATION = 3 years
+
diff --git a/src/util/donau-secmod-rsa.conf b/src/util/donau-secmod-rsa.conf
@@ -23,4 +23,4 @@ SM_PRIV_KEY = ${DONAU_DATA_HOME}donau-secmod-rsa/secmod-private-key
LOOKAHEAD_SIGN = 2 year
# Round down anchor key start date to multiples of this time.
-ANCHOR_ROUND = 1 year
-\ No newline at end of file
+ANCHOR_ROUND = 1 year