[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 03/03: worked on payment...
From: |
gnunet |
Subject: |
[taler-anastasis] 03/03: worked on payment... |
Date: |
Thu, 10 Dec 2020 11:29:36 +0100 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit bf6a766239d5bae398fcf8d21049941265a3608c
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Thu Dec 10 11:24:19 2020 +0100
worked on payment...
---
src/cli/test_anastasis_reducer_enter_secret.sh | 68 +++++++++++++++-------
src/cli/test_anastasis_reducer_initialize_state.sh | 46 +--------------
src/cli/test_anastasis_reducer_select_continent.sh | 44 +-------------
3 files changed, 50 insertions(+), 108 deletions(-)
diff --git a/src/cli/test_anastasis_reducer_enter_secret.sh
b/src/cli/test_anastasis_reducer_enter_secret.sh
index 879a10f..ef6e28f 100755
--- a/src/cli/test_anastasis_reducer_enter_secret.sh
+++ b/src/cli/test_anastasis_reducer_enter_secret.sh
@@ -1,4 +1,9 @@
#!/bin/bash
+## Coloring style Text shell script
+COLOR='\033[0;35m'
+NOCOLOR='\033[0m'
+BOLD="$(tput bold)"
+NORM="$(tput sgr0)"
set -eu
@@ -22,11 +27,13 @@ function cleanup()
kill $n 2> /dev/null || true
done
rm -f $CONF $CONF_1 $CONF_2 $CONF_3 $CONF_4 $WALLET_DB
+ rm -r $TMP_DIR
wait
}
# Install cleanup handler (except for kill -9)
-WALLET_DB=`mktemp test_reducer_walletXXXXXX`
+TMP_DIR=`mktemp -d keys-tmp-XXXXXX`
+WALLET_DB=`mktemp test_reducer_walletXXXXXX.json`
CONF=`mktemp test_reducerXXXXXX.conf`
CONF_1=`mktemp test_reducerXXXXXX_1.conf`
CONF_2=`mktemp test_reducerXXXXXX_2.conf`
@@ -58,6 +65,19 @@ echo -n "Testing for anastasis-httpd"
anastasis-httpd -h >/dev/null </dev/null || exit_skip " MISSING"
echo " FOUND"
+if [ -e $SFILE ]
+then
+ echo " "
+ echo "Ressources existing"
+else
+ echo " "
+ echo "Ressources not existing..."
+ echo "Setting up ressources..."
+ # run other tests before to set up ressources
+ make check
+ echo "Ressources created"
+fi
+
# Name of the Postgres database we will use for the script.
# Will be dropped, do NOT use anything that might be used
# elsewhere
@@ -114,6 +134,7 @@ taler-config -c $CONF -s exchangedb-postgres -o CONFIG -V
postgres:///$TALER_DB
taler-config -c $CONF -s auditordb-postgres -o CONFIG -V postgres:///$TALER_DB
taler-config -c $CONF -s merchantdb-postgres -o CONFIG -V postgres:///$TALER_DB
taler-config -c $CONF -s bank -o database -V postgres:///$TALER_DB
+taler-config -c $CONF -s exchange -o KEYDIR -V "${TMP_DIR}/keydir/"
# setup exchange
echo "Setting up exchange"
@@ -187,11 +208,11 @@ echo " ANASTASIS SETUP DONE"
echo " "
echo " "
echo " "
-echo "Beginning with actual reducer test"
+echo -e $COLOR$BOLD"Beginning with actual reducer test"$NORM$NOCOLOR
# Test enter secret in a backup state
echo " "
-echo "Test enter secret in a backup state"
+echo -e $COLOR$BOLD"Test enter secret in a backup state"$NORM$NOCOLOR
mkdir -p ressources
touch $TFILE
./anastasis-reducer -a \
@@ -212,35 +233,42 @@ then
fi
echo " "
-echo "Current state of policy uploads:"
+echo -e $COLOR$BOLD"Current state of policy uploads:"$NORM$NOCOLOR
POLICY_UPLOADS=`jq -r -e .recovery_document_uploads < $TFILE`
echo $POLICY_UPLOADS
#Pay
echo " "
-echo "Try to pay for upload"
+echo -e $COLOR$BOLD"Try to pay for upload"$NORM$NOCOLOR
#First make a withdraw to wallet
+echo " "
+echo -e $COLOR$BOLD"Withdrawing amount to wallet"$NORM$NOCOLOR
taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api
'withdrawTestBalance' \
- "$(jq -n '
- {
- amount: "TESTKUDOS:20",
- bankBaseUrl: $BANK_URL,
- exchangeBaseUrl: $EXCHANGE_URL,
- }' \
- --arg BANK_URL "$BANK_URL" \
- --arg EXCHANGE_URL "$EXCHANGE_URL"
- )"
-taler-wallet-cli --wallet-db=$WALLET_DB run-pending
+ "$(jq -n '
+ {
+ amount: "TESTKUDOS:20",
+ bankBaseUrl: $BANK_URL,
+ exchangeBaseUrl: $EXCHANGE_URL
+ }' \
+ --arg BANK_URL "$BANK_URL" \
+ --arg EXCHANGE_URL "$EXCHANGE_URL"
+ )"
+taler-wallet-cli --wallet-db=$WALLET_DB run-until-done
+echo " "
+echo -e $COLOR$BOLD"Parsing policy uploads for payment-uri"$NORM$NOCOLOR
ARRAY_LENGTH=`jq -r -e '.recovery_document_uploads | length' < $TFILE`
for ((INDEX=0; INDEX < $ARRAY_LENGTH; INDEX++))
do
- PAY_URL=`jq -r -e .recovery_document_uploads[$INDEX].pay_url < $TFILE`
- echo "PAY_URL: $PAY_URL"
+ PAY_URI=`jq -r -e .recovery_document_uploads[$INDEX].pay_url < $TFILE`
+ echo " "
+ echo "[$INDEX] PAY_URI: $PAY_URI"
# run wallet CLI
- echo "Running wallet"
- taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB handle-uri $PAY_URL
+ echo " "
+ echo -e $COLOR$BOLD"[$INDEX] Running wallet handle-uri"$NORM$NOCOLOR
+ taler-wallet-cli --wallet-db=$WALLET_DB handle-uri $PAY_URI -y
done
+echo " "
+echo -e $COLOR$BOLD"Running wallet run-pending"$NORM$NOCOLOR
taler-wallet-cli --wallet-db=$WALLET_DB run-pending
-
exit 0
diff --git a/src/cli/test_anastasis_reducer_initialize_state.sh
b/src/cli/test_anastasis_reducer_initialize_state.sh
index 2a730e8..87f45e9 100755
--- a/src/cli/test_anastasis_reducer_initialize_state.sh
+++ b/src/cli/test_anastasis_reducer_initialize_state.sh
@@ -21,12 +21,11 @@ function cleanup()
do
kill $n 2> /dev/null || true
done
- rm -f $SFILE $TFILE $CONF
+ rm -f $SFILE $TFILE
wait
}
# Install cleanup handler (except for kill -9)
-CONF=`mktemp test_reducerXXXXXX.conf`
SFILE=`mktemp test_reducer_stateXXXXXX`
TFILE=`mktemp test_reducer_stateXXXXXX`
@@ -37,52 +36,9 @@ echo -n "Testing for jq"
jq -h > /dev/null || exit_skip "jq required"
echo " FOUND"
-echo -n "Testing for anastasis-httpd"
-anastasis-httpd -h >/dev/null </dev/null || exit_skip " MISSING"
-echo " FOUND"
-
-
-# Name of the Postgres database we will use for the script.
-# Will be dropped, do NOT use anything that might be used
-# elsewhere
-TARGET_DB=anastasischeck
-
-# Configuration file will be edited, so we create one
-# from the template.
-cp test_anastasis_reducer.conf $CONF
-
-# reset database
-dropdb $TARGET_DB >/dev/null 2>/dev/null || true
-createdb $TARGET_DB || exit_skip "Could not create database $TARGET_DB"
-
-# Launch services
-echo "Launching anastasis service"
-anastasis-httpd -c $CONF 2> anastasis-httpd.log &
-
-# Wait for anastasis service to be available
-for n in `seq 1 50`
-do
- echo -n "."
- sleep 0.1
- OK=0
- # anastasis
- wget http://localhost:8086/ -o /dev/null -O /dev/null >/dev/null ||
continue
- OK=1
- break
-done
-
-if [ 1 != $OK ]
-then
- exit_skip "Failed to launch anastasis service"
-fi
-
-echo " ANASTASIS SETUP DONE"
-echo " "
-echo " "
echo " "
echo "Beginning with actual reducer test"
-
echo " "
echo "Test initialization of a backup state"
./anastasis-reducer -b $SFILE
diff --git a/src/cli/test_anastasis_reducer_select_continent.sh
b/src/cli/test_anastasis_reducer_select_continent.sh
index cf0a437..404c58c 100755
--- a/src/cli/test_anastasis_reducer_select_continent.sh
+++ b/src/cli/test_anastasis_reducer_select_continent.sh
@@ -21,7 +21,7 @@ function cleanup()
do
kill $n 2> /dev/null || true
done
- rm -f $SFILE $TFILE $CONF
+ rm -f $SFILE $TFILE
wait
}
@@ -37,48 +37,6 @@ echo -n "Testing for jq"
jq -h > /dev/null || exit_skip "jq required"
echo " FOUND"
-echo -n "Testing for anastasis-httpd"
-anastasis-httpd -h >/dev/null </dev/null || exit_skip " MISSING"
-echo " FOUND"
-
-
-# Name of the Postgres database we will use for the script.
-# Will be dropped, do NOT use anything that might be used
-# elsewhere
-TARGET_DB=anastasischeck
-
-# Configuration file will be edited, so we create one
-# from the template.
-cp test_anastasis_reducer.conf $CONF
-
-# reset database
-dropdb $TARGET_DB >/dev/null 2>/dev/null || true
-createdb $TARGET_DB || exit_skip "Could not create database $TARGET_DB"
-
-# Launch services
-echo "Launching anastasis service"
-anastasis-httpd -c $CONF 2> anastasis-httpd.log &
-
-# Wait for anastasis service to be available
-for n in `seq 1 50`
-do
- echo -n "."
- sleep 0.1
- OK=0
- # anastasis
- wget http://localhost:8086/ -o /dev/null -O /dev/null >/dev/null ||
continue
- OK=1
- break
-done
-
-if [ 1 != $OK ]
-then
- exit_skip "Failed to launch anastasis service"
-fi
-
-echo " ANASTASIS SETUP DONE"
-echo " "
-echo " "
echo " "
echo "Beginning with actual reducer test"
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.