-use private DB for tests
This commit is contained in:
parent
27ee193e34
commit
05cf62b397
@ -1 +1 @@
|
|||||||
Subproject commit 5f6a1413a6053d1999064768188f1671eb015897
|
Subproject commit 75c838e74c41bf9a6c02cdfe8109a444056bf26d
|
@ -1 +1 @@
|
|||||||
Subproject commit b988d98d4856758484eb23c27bfdc9e602d4235a
|
Subproject commit 74d9c44ebc257a3d8b9c2c0a806508bd0cc5269a
|
@ -65,11 +65,14 @@ rm -f $WALLET_DB
|
|||||||
# delete libeufin database
|
# delete libeufin database
|
||||||
rm -f $TARGET_DB
|
rm -f $TARGET_DB
|
||||||
|
|
||||||
|
|
||||||
# Configuration file will be edited, so we create one
|
# Configuration file will be edited, so we create one
|
||||||
# from the template.
|
# from the template.
|
||||||
CONF_ONCE=${BASEDB}.conf
|
CONF_ONCE=${BASEDB}.conf
|
||||||
cp generate-auditor-basedb.conf $CONF_ONCE
|
cp generate-auditor-basedb.conf $CONF_ONCE
|
||||||
taler-config -c ${CONF_ONCE} -s exchange-offline -o MASTER_PRIV_FILE -V ${BASEDB}.mpriv
|
taler-config -c ${CONF_ONCE} -s exchange-offline -o MASTER_PRIV_FILE -V ${BASEDB}.mpriv
|
||||||
|
|
||||||
|
|
||||||
echo -n "Testing for libeufin"
|
echo -n "Testing for libeufin"
|
||||||
libeufin-cli --help >/dev/null </dev/null || exit_skip " MISSING"
|
libeufin-cli --help >/dev/null </dev/null || exit_skip " MISSING"
|
||||||
echo " FOUND"
|
echo " FOUND"
|
||||||
@ -80,8 +83,6 @@ echo -n "Testing for curl"
|
|||||||
curl --help >/dev/null </dev/null || exit_skip " MISSING"
|
curl --help >/dev/null </dev/null || exit_skip " MISSING"
|
||||||
echo " FOUND"
|
echo " FOUND"
|
||||||
|
|
||||||
|
|
||||||
pwd
|
|
||||||
# Clean up
|
# Clean up
|
||||||
|
|
||||||
DATA_DIR=`taler-config -f -c $CONF_ONCE -s PATHS -o TALER_HOME`
|
DATA_DIR=`taler-config -f -c $CONF_ONCE -s PATHS -o TALER_HOME`
|
||||||
|
@ -14,10 +14,18 @@ function cleanup()
|
|||||||
do
|
do
|
||||||
kill $n 2> /dev/null || true
|
kill $n 2> /dev/null || true
|
||||||
done
|
done
|
||||||
echo Killing euFin..
|
|
||||||
kill `cat libeufin-sandbox.pid 2> /dev/null` &> /dev/null || true
|
|
||||||
kill `cat libeufin-nexus.pid 2> /dev/null` &> /dev/null || true
|
|
||||||
wait
|
wait
|
||||||
|
if test -f libeufin-sandbox.pid
|
||||||
|
then
|
||||||
|
echo "Killing libeufin sandbox"
|
||||||
|
kill `cat libeufin-sandbox.pid 2> /dev/null` &> /dev/null || true
|
||||||
|
fi
|
||||||
|
if test -f libeufin-nexus.pid
|
||||||
|
then
|
||||||
|
echo "Killing libeufin nexus"
|
||||||
|
kill `cat libeufin-nexus.pid 2> /dev/null` &> /dev/null || true
|
||||||
|
fi
|
||||||
|
rm -f libeufin-sandbox.pid libeufin-nexus.pid
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_payto_uri() {
|
function get_payto_uri() {
|
||||||
|
@ -35,28 +35,39 @@ LIBEUFIN_SETTLE_TIME=1
|
|||||||
|
|
||||||
# Exit, with status code "skip" (no 'real' failure)
|
# Exit, with status code "skip" (no 'real' failure)
|
||||||
function exit_skip() {
|
function exit_skip() {
|
||||||
echo $1
|
echo "SKIPPING test: $1"
|
||||||
exit 77
|
exit 77
|
||||||
}
|
}
|
||||||
|
|
||||||
# Exit, with error message (hard failure)
|
# Exit, with error message (hard failure)
|
||||||
function exit_fail() {
|
function exit_fail() {
|
||||||
echo $1
|
echo "FAILING test: $1"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Cleanup to run whenever we exit
|
# Cleanup to run whenever we exit
|
||||||
function cleanup()
|
function cleanup()
|
||||||
{
|
{
|
||||||
|
if test ! -z ${POSTGRES_PATH:-}
|
||||||
|
then
|
||||||
|
${POSTGRES_PATH}/pg_ctl -D $TMPDIR -l /dev/null stop &> /dev/null || true
|
||||||
|
fi
|
||||||
for n in `jobs -p`
|
for n in `jobs -p`
|
||||||
do
|
do
|
||||||
kill $n 2> /dev/null || true
|
kill $n 2> /dev/null || true
|
||||||
done
|
done
|
||||||
wait
|
wait
|
||||||
# kill euFin
|
# kill euFin
|
||||||
echo -n "Killing euFin.."
|
if test -f libeufin-sandbox.pid
|
||||||
kill `cat libeufin-sandbox.pid 2> /dev/null` &> /dev/null || true
|
then
|
||||||
kill `cat libeufin-nexus.pid 2> /dev/null` &> /dev/null || true
|
echo "Killing libeufin sandbox"
|
||||||
|
kill `cat libeufin-sandbox.pid 2> /dev/null` &> /dev/null || true
|
||||||
|
fi
|
||||||
|
if test -f libeufin-nexus.pid
|
||||||
|
then
|
||||||
|
echo "Killing libeufin nexus"
|
||||||
|
kill `cat libeufin-nexus.pid 2> /dev/null` &> /dev/null || true
|
||||||
|
fi
|
||||||
echo DONE
|
echo DONE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1978,14 +1989,41 @@ echo "Testing for faketime"
|
|||||||
faketime -h > /dev/null || exit_skip "faketime required"
|
faketime -h > /dev/null || exit_skip "faketime required"
|
||||||
# NOTE: really check for all three libeufin commands?
|
# NOTE: really check for all three libeufin commands?
|
||||||
echo "Testing for libeufin"
|
echo "Testing for libeufin"
|
||||||
libeufin-cli --help >/dev/null </dev/null || exit_skip "libeufin required"
|
libeufin-cli --help >/dev/null 2> /dev/null </dev/null || exit_skip "libeufin required"
|
||||||
echo "Testing for pdflatex"
|
echo "Testing for pdflatex"
|
||||||
which pdflatex > /dev/null </dev/null || exit_skip "pdflatex required"
|
which pdflatex > /dev/null </dev/null || exit_skip "pdflatex required"
|
||||||
|
|
||||||
# check if we should regenerate the database
|
|
||||||
echo "Testing for taler-wallet-cli"
|
echo "Testing for taler-wallet-cli"
|
||||||
taler-wallet-cli -h >/dev/null </dev/null 2>/dev/null || exit_skip "taler-wallet-cli required"
|
taler-wallet-cli -h >/dev/null </dev/null 2>/dev/null || exit_skip "taler-wallet-cli required"
|
||||||
MYDIR=`mktemp -d /tmp/taler-auditor-basedbXXXXXX`
|
MYDIR=`mktemp -d /tmp/taler-auditor-basedbXXXXXX`
|
||||||
|
|
||||||
|
|
||||||
|
echo -n "Testing for Postgres"
|
||||||
|
HAVE_INITDB=`find /usr -name "initdb" | grep postgres` || exit_skip " MISSING"
|
||||||
|
echo " FOUND"
|
||||||
|
echo -n "Setting up Postgres DB"
|
||||||
|
INITDB_BIN=`find /usr -name "initdb" | grep bin/initdb | grep postgres | sort -n | tail -n1`
|
||||||
|
POSTGRES_PATH=`basename $INITDB_BIN`
|
||||||
|
TMPDIR=`mktemp -d /tmp/taler-test-postgresXXXXXX`
|
||||||
|
$INITDB_BIN --no-sync --auth=trust -D ${TMPDIR} > postgres-dbinit.log 2> postgres-dbinit.err
|
||||||
|
echo " DONE"
|
||||||
|
mkdir ${TMPDIR}/sockets
|
||||||
|
echo -n "Launching Postgres service"
|
||||||
|
cat - >> $TMPDIR/postgresql.conf <<EOF
|
||||||
|
unix_socket_directories='${TMPDIR}/sockets'
|
||||||
|
fsync=off
|
||||||
|
max_wal_senders=0
|
||||||
|
synchronous_commit=off
|
||||||
|
wal_level=minimal
|
||||||
|
listen_addresses=''
|
||||||
|
EOF
|
||||||
|
cat $TMPDIR/pg_hba.conf | grep -v host > $TMPDIR/pg_hba.conf.new
|
||||||
|
mv $TMPDIR/pg_hba.conf.new $TMPDIR/pg_hba.conf
|
||||||
|
${POSTGRES_PATH}/pg_ctl -D $TMPDIR -l /dev/null start > postgres-start.log 2> postgres-start.err
|
||||||
|
echo " DONE"
|
||||||
|
PGHOST="$TMPDIR/sockets"
|
||||||
|
EXPORT PGHOST="@POSTGRES_SOCKET"
|
||||||
|
|
||||||
|
|
||||||
echo "Generating fresh database at $MYDIR"
|
echo "Generating fresh database at $MYDIR"
|
||||||
if faketime -f '-1 d' ./generate-auditor-basedb.sh $MYDIR/basedb
|
if faketime -f '-1 d' ./generate-auditor-basedb.sh $MYDIR/basedb
|
||||||
then
|
then
|
||||||
@ -1996,6 +2034,7 @@ then
|
|||||||
else
|
else
|
||||||
echo "Cleaning up $MYDIR..."
|
echo "Cleaning up $MYDIR..."
|
||||||
rm -rf $MYDIR || echo "Removing $MYDIR failed"
|
rm -rf $MYDIR || echo "Removing $MYDIR failed"
|
||||||
|
rm -rf $TMPDIR || echo "Removing $TMPDIR failed"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Generation failed"
|
echo "Generation failed"
|
||||||
|
@ -29,39 +29,39 @@ VALGRIND=""
|
|||||||
|
|
||||||
# Exit, with status code "skip" (no 'real' failure)
|
# Exit, with status code "skip" (no 'real' failure)
|
||||||
function exit_skip() {
|
function exit_skip() {
|
||||||
echo $1
|
echo "SKIPPING test: $1"
|
||||||
exit 77
|
exit 77
|
||||||
}
|
}
|
||||||
|
|
||||||
# Exit, with error message (hard failure)
|
# Exit, with error message (hard failure)
|
||||||
function exit_fail() {
|
function exit_fail() {
|
||||||
echo $1
|
echo "FAILING test: $1"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Cleanup to run whenever we exit
|
# Cleanup to run whenever we exit
|
||||||
function cleanup()
|
function cleanup()
|
||||||
{
|
{
|
||||||
|
if test ! -z ${POSTGRES_PATH:-}
|
||||||
|
then
|
||||||
|
${POSTGRES_PATH}/pg_ctl -D $TMPDIR -l /dev/null stop &> /dev/null || true
|
||||||
|
fi
|
||||||
for n in `jobs -p`
|
for n in `jobs -p`
|
||||||
do
|
do
|
||||||
kill $n 2> /dev/null || true
|
kill $n 2> /dev/null || true
|
||||||
done
|
done
|
||||||
wait
|
wait
|
||||||
# kill euFin
|
if test -f libeufin-sandbox.pid
|
||||||
echo Killing euFin..
|
then
|
||||||
kill `cat libeufin-sandbox.pid 2> /dev/null` &> /dev/null || true
|
echo "Killing libeufin sandbox"
|
||||||
kill `cat libeufin-nexus.pid 2> /dev/null` &> /dev/null || true
|
kill `cat libeufin-sandbox.pid 2> /dev/null` &> /dev/null || true
|
||||||
# So far only Sandbox gave exit issues / delays ..
|
fi
|
||||||
count=0
|
if test -f libeufin-nexus.pid
|
||||||
while ps xo pid | grep `cat libeufin-sandbox.pid`; do
|
then
|
||||||
if test $count = 5; then
|
echo "Killing libeufin nexus"
|
||||||
echo "Sandbox unkillable, failing now .."
|
kill `cat libeufin-nexus.pid 2> /dev/null` &> /dev/null || true
|
||||||
exit 1
|
fi
|
||||||
fi
|
rm -f libeufin-sandbox.pid libeufin-nexus.pid
|
||||||
echo "Sandbox didn't exit yet.."
|
|
||||||
sleep 1;
|
|
||||||
count=`expr $count + 1`
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install cleanup handler (except for kill -9)
|
# Install cleanup handler (except for kill -9)
|
||||||
@ -576,12 +576,39 @@ jq -h > /dev/null || exit_skip "jq required"
|
|||||||
echo "Testing for faketime"
|
echo "Testing for faketime"
|
||||||
faketime -h > /dev/null || exit_skip "faketime required"
|
faketime -h > /dev/null || exit_skip "faketime required"
|
||||||
echo "Testing for libeufin(-cli)"
|
echo "Testing for libeufin(-cli)"
|
||||||
libeufin-cli --help >/dev/null </dev/null || exit_skip "libeufin required"
|
libeufin-cli --help >/dev/null 2> /dev/null </dev/null || exit_skip "libeufin required"
|
||||||
echo "Testing for pdflatex"
|
echo "Testing for pdflatex"
|
||||||
which pdflatex > /dev/null </dev/null || exit_skip "pdflatex required"
|
which pdflatex > /dev/null </dev/null || exit_skip "pdflatex required"
|
||||||
|
|
||||||
echo "Testing for taler-wallet-cli"
|
echo "Testing for taler-wallet-cli"
|
||||||
taler-wallet-cli -h >/dev/null </dev/null 2>/dev/null || exit_skip "taler-wallet-cli required"
|
taler-wallet-cli -h >/dev/null </dev/null 2>/dev/null || exit_skip "taler-wallet-cli required"
|
||||||
|
|
||||||
|
echo -n "Testing for Postgres"
|
||||||
|
HAVE_INITDB=`find /usr -name "initdb" | grep postgres` || exit_skip " MISSING"
|
||||||
|
echo " FOUND"
|
||||||
|
echo -n "Setting up Postgres DB"
|
||||||
|
INITDB_BIN=`find /usr -name "initdb" | grep bin/initdb | grep postgres | sort -n | tail -n1`
|
||||||
|
POSTGRES_PATH=`basename $INITDB_BIN`
|
||||||
|
TMPDIR=`mktemp -d /tmp/taler-test-postgresXXXXXX`
|
||||||
|
$INITDB_BIN --no-sync --auth=trust -D ${TMPDIR} > postgres-dbinit.log 2> postgres-dbinit.err
|
||||||
|
echo " DONE"
|
||||||
|
mkdir ${TMPDIR}/sockets
|
||||||
|
echo -n "Launching Postgres service"
|
||||||
|
cat - >> $TMPDIR/postgresql.conf <<EOF
|
||||||
|
unix_socket_directories='${TMPDIR}/sockets'
|
||||||
|
fsync=off
|
||||||
|
max_wal_senders=0
|
||||||
|
synchronous_commit=off
|
||||||
|
wal_level=minimal
|
||||||
|
listen_addresses=''
|
||||||
|
EOF
|
||||||
|
cat $TMPDIR/pg_hba.conf | grep -v host > $TMPDIR/pg_hba.conf.new
|
||||||
|
mv $TMPDIR/pg_hba.conf.new $TMPDIR/pg_hba.conf
|
||||||
|
${POSTGRES_PATH}/pg_ctl -D $TMPDIR -l /dev/null start > postgres-start.log 2> postgres-start.err
|
||||||
|
echo " DONE"
|
||||||
|
PGHOST="$TMPDIR/sockets"
|
||||||
|
EXPORT PGHOST="@POSTGRES_SOCKET"
|
||||||
|
|
||||||
|
|
||||||
MYDIR=`mktemp -d /tmp/taler-auditor-basedbXXXXXX`
|
MYDIR=`mktemp -d /tmp/taler-auditor-basedbXXXXXX`
|
||||||
echo "Generating fresh database at $MYDIR"
|
echo "Generating fresh database at $MYDIR"
|
||||||
if faketime -f '-1 d' ./generate-revoke-basedb.sh $MYDIR/basedb
|
if faketime -f '-1 d' ./generate-revoke-basedb.sh $MYDIR/basedb
|
||||||
@ -593,6 +620,7 @@ then
|
|||||||
else
|
else
|
||||||
echo "Cleaning up $MYDIR..."
|
echo "Cleaning up $MYDIR..."
|
||||||
rm -rf $MYDIR || echo "Removing $MYDIR failed"
|
rm -rf $MYDIR || echo "Removing $MYDIR failed"
|
||||||
|
rm -rf $TMPDIR || echo "Removing $TMPDIR failed"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Generation failed"
|
echo "Generation failed"
|
||||||
|
@ -1,20 +1,36 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
# Exit, with status code "skip" (no 'real' failure)
|
# Exit, with status code "skip" (no 'real' failure)
|
||||||
exit_skip() {
|
function exit_skip() {
|
||||||
echo $1
|
echo "SKIPPING test: $1"
|
||||||
exit 77
|
exit 77
|
||||||
}
|
}
|
||||||
|
|
||||||
# Exit, with error message (hard failure)
|
# Exit, with error message (hard failure)
|
||||||
exit_fail() {
|
function exit_fail() {
|
||||||
echo $1
|
echo "FAILING test: $1"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
check_with_database()
|
# Cleanup to run whenever we exit
|
||||||
|
function cleanup() {
|
||||||
|
if test ! -z ${POSTGRES_PATH:-}
|
||||||
|
then
|
||||||
|
${POSTGRES_PATH}/pg_ctl -D $TMPDIR stop &> /dev/null || true
|
||||||
|
fi
|
||||||
|
for n in `jobs -p`
|
||||||
|
do
|
||||||
|
kill $n 2> /dev/null || true
|
||||||
|
done
|
||||||
|
wait
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install cleanup handler (except for kill -9)
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
function check_with_database()
|
||||||
{
|
{
|
||||||
echo -n "Testing synchronization logic ..."
|
echo -n "Testing synchronization logic ..."
|
||||||
|
|
||||||
@ -68,15 +84,41 @@ echo "Testing for jq"
|
|||||||
jq -h > /dev/null || exit_skip "jq required"
|
jq -h > /dev/null || exit_skip "jq required"
|
||||||
echo "Testing for faketime"
|
echo "Testing for faketime"
|
||||||
faketime -h > /dev/null || exit_skip "faketime required"
|
faketime -h > /dev/null || exit_skip "faketime required"
|
||||||
# NOTE: really check for all three libeufin commands?
|
|
||||||
echo "Testing for libeufin"
|
echo "Testing for libeufin"
|
||||||
libeufin-cli --help >/dev/null </dev/null || exit_skip "libeufin required"
|
libeufin-cli --help >/dev/null </dev/null 2> /dev/null || exit_skip "libeufin required"
|
||||||
echo "Testing for pdflatex"
|
echo "Testing for pdflatex"
|
||||||
which pdflatex > /dev/null </dev/null || exit_skip "pdflatex required"
|
which pdflatex > /dev/null </dev/null || exit_skip "pdflatex required"
|
||||||
|
|
||||||
# check if we should regenerate the database
|
|
||||||
echo "Testing for taler-wallet-cli"
|
echo "Testing for taler-wallet-cli"
|
||||||
taler-wallet-cli -h >/dev/null </dev/null 2>/dev/null || exit_skip "taler-wallet-cli required"
|
taler-wallet-cli -h >/dev/null </dev/null 2>/dev/null || exit_skip "taler-wallet-cli required"
|
||||||
|
|
||||||
|
echo -n "Testing for Postgres"
|
||||||
|
HAVE_INITDB=`find /usr -name "initdb" | grep postgres` || exit_skip " MISSING"
|
||||||
|
echo " FOUND"
|
||||||
|
echo -n "Setting up Postgres DB"
|
||||||
|
INITDB_BIN=`find /usr -name "initdb" | grep bin/initdb | grep postgres | sort -n | tail -n1`
|
||||||
|
POSTGRES_PATH=`basename $INITDB_BIN`
|
||||||
|
TMPDIR=`mktemp -d /tmp/taler-test-postgresXXXXXX`
|
||||||
|
$INITDB_BIN --no-sync --auth=trust -D ${TMPDIR} > postgres-dbinit.log 2> postgres-dbinit.err
|
||||||
|
echo " DONE"
|
||||||
|
mkdir ${TMPDIR}/sockets
|
||||||
|
echo -n "Launching Postgres service"
|
||||||
|
cat - >> $TMPDIR/postgresql.conf <<EOF
|
||||||
|
unix_socket_directories='${TMPDIR}/sockets'
|
||||||
|
fsync=off
|
||||||
|
max_wal_senders=0
|
||||||
|
synchronous_commit=off
|
||||||
|
wal_level=minimal
|
||||||
|
listen_addresses=''
|
||||||
|
EOF
|
||||||
|
cat $TMPDIR/pg_hba.conf | grep -v host > $TMPDIR/pg_hba.conf.new
|
||||||
|
mv $TMPDIR/pg_hba.conf.new $TMPDIR/pg_hba.conf
|
||||||
|
${POSTGRES_PATH}/pg_ctl -D $TMPDIR -l /dev/null start > postgres-start.log 2> postgres-start.err
|
||||||
|
echo " DONE"
|
||||||
|
PGHOST="$TMPDIR/sockets"
|
||||||
|
EXPORT PGHOST="@POSTGRES_SOCKET"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MYDIR=`mktemp -d /tmp/taler-auditor-basedbXXXXXX`
|
MYDIR=`mktemp -d /tmp/taler-auditor-basedbXXXXXX`
|
||||||
echo "Generating fresh database at $MYDIR"
|
echo "Generating fresh database at $MYDIR"
|
||||||
if faketime -f '-1 d' ./generate-auditor-basedb.sh $MYDIR/basedb
|
if faketime -f '-1 d' ./generate-auditor-basedb.sh $MYDIR/basedb
|
||||||
@ -88,6 +130,7 @@ then
|
|||||||
else
|
else
|
||||||
echo "Cleaning up $MYDIR..."
|
echo "Cleaning up $MYDIR..."
|
||||||
rm -rf $MYDIR || echo "Removing $MYDIR failed"
|
rm -rf $MYDIR || echo "Removing $MYDIR failed"
|
||||||
|
rm -rf $TMPDIR || echo "Removing $TMPDIR failed"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Generation failed"
|
echo "Generation failed"
|
||||||
|
Loading…
Reference in New Issue
Block a user