aboutsummaryrefslogtreecommitdiff
path: root/src/cli/test_anastasis_reducer_enter_secret.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/test_anastasis_reducer_enter_secret.sh')
-rwxr-xr-xsrc/cli/test_anastasis_reducer_enter_secret.sh57
1 files changed, 40 insertions, 17 deletions
diff --git a/src/cli/test_anastasis_reducer_enter_secret.sh b/src/cli/test_anastasis_reducer_enter_secret.sh
index 2103679..36a764d 100755
--- a/src/cli/test_anastasis_reducer_enter_secret.sh
+++ b/src/cli/test_anastasis_reducer_enter_secret.sh
@@ -22,6 +22,27 @@ function exit_fail() {
22 exit 1 22 exit 1
23} 23}
24 24
25# Stop libeufin sandbox and nexus (if running)
26function stop_libeufin()
27{
28 echo "Stopping libeufin..."
29 if test -f libeufin-sandbox.pid
30 then
31 PID=`cat libeufin-sandbox.pid 2> /dev/null`
32 echo "Killing libeufin sandbox $PID"
33 rm libeufin-sandbox.pid
34 kill $PID 2> /dev/null || true
35 fi
36 if test -f libeufin-nexus.pid
37 then
38 PID=`cat libeufin-nexus.pid 2> /dev/null`
39 echo "Killing libeufin nexus $PID"
40 rm libeufin-nexus.pid
41 kill $PID 2> /dev/null || true
42 fi
43 echo "Stopping libeufin DONE"
44}
45
25# Cleanup to run whenever we exit 46# Cleanup to run whenever we exit
26function cleanup() 47function cleanup()
27{ 48{
@@ -29,6 +50,7 @@ function cleanup()
29 do 50 do
30 kill $n 2> /dev/null || true 51 kill $n 2> /dev/null || true
31 done 52 done
53 stop_libeufin
32 rm -rf $CONF $WALLET_DB $TFILE $UFILE $TMP_DIR 54 rm -rf $CONF $WALLET_DB $TFILE $UFILE $TMP_DIR
33 wait 55 wait
34} 56}
@@ -113,8 +135,8 @@ MASTER_PUB=`gnunet-ecc -p $MASTER_PRIV_FILE`
113EXCHANGE_URL=`taler-config -c $CONF -s EXCHANGE -o BASE_URL` 135EXCHANGE_URL=`taler-config -c $CONF -s EXCHANGE -o BASE_URL`
114MERCHANT_PORT=`taler-config -c $CONF -s MERCHANT -o PORT` 136MERCHANT_PORT=`taler-config -c $CONF -s MERCHANT -o PORT`
115MERCHANT_URL=http://localhost:${MERCHANT_PORT}/ 137MERCHANT_URL=http://localhost:${MERCHANT_PORT}/
116BANK_PORT=`taler-config -c $CONF -s BANK -o HTTP_PORT` 138NEXUS_PORT=8082
117BANK_URL=http://localhost:${BANK_PORT}/ 139BANK_URL=http://localhost:1${NEXUS_PORT}/
118AUDITOR_URL=http://localhost:8083/ 140AUDITOR_URL=http://localhost:8083/
119AUDITOR_PRIV_FILE=`taler-config -f -c $CONF -s AUDITOR -o AUDITOR_PRIV_FILE` 141AUDITOR_PRIV_FILE=`taler-config -f -c $CONF -s AUDITOR -o AUDITOR_PRIV_FILE`
120AUDITOR_PRIV_DIR=`dirname $AUDITOR_PRIV_FILE` 142AUDITOR_PRIV_DIR=`dirname $AUDITOR_PRIV_FILE`
@@ -149,13 +171,14 @@ echo " OK"
149 171
150# Launch services 172# Launch services
151echo -n "Launching taler services ..." 173echo -n "Launching taler services ..."
152taler-bank-manage-testing $BANK_PORT $TALER_DB $EXCHANGE_URL $CONF > taler-bank.log 2> taler-bank.err & 174rm -f $TALER_DB
175taler-bank-manage-testing $NEXUS_PORT $TALER_DB $EXCHANGE_URL $CONF > taler-bank.log 2> taler-bank.err &
153taler-exchange-secmod-eddsa -c $CONF 2> taler-exchange-secmod-eddsa.log & 176taler-exchange-secmod-eddsa -c $CONF 2> taler-exchange-secmod-eddsa.log &
154taler-exchange-secmod-rsa -c $CONF 2> taler-exchange-secmod-rsa.log & 177taler-exchange-secmod-rsa -c $CONF 2> taler-exchange-secmod-rsa.log &
155taler-exchange-secmod-cs -c $CONF 2> taler-exchange-secmod-cs.log & 178taler-exchange-secmod-cs -c $CONF 2> taler-exchange-secmod-cs.log &
156taler-exchange-httpd -c $CONF 2> taler-exchange-httpd.log & 179taler-exchange-httpd -L INFO -c $CONF 2> taler-exchange-httpd.log &
157taler-merchant-httpd -c $CONF -L INFO 2> taler-merchant-httpd.log & 180taler-merchant-httpd -L INFO -c $CONF -L INFO 2> taler-merchant-httpd.log &
158taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log & 181taler-exchange-wirewatch -L INFO --longpoll-timeout=1s -c $CONF 2> taler-exchange-wirewatch.log &
159taler-auditor-httpd -L INFO -c $CONF 2> taler-auditor-httpd.log & 182taler-auditor-httpd -L INFO -c $CONF 2> taler-auditor-httpd.log &
160 183
161echo " OK" 184echo " OK"
@@ -211,9 +234,9 @@ echo -n "Setting up keys ..."
211taler-exchange-offline -c $CONF \ 234taler-exchange-offline -c $CONF \
212 download \ 235 download \
213 sign \ 236 sign \
214 enable-account payto://x-taler-bank/localhost/Exchange \ 237 enable-account `taler-config -c $CONF -s exchange-account-1 -o PAYTO_URI` \
215 enable-auditor $AUDITOR_PUB $AUDITOR_URL "TESTKUDOS Auditor" \ 238 enable-auditor $AUDITOR_PUB $AUDITOR_URL "TESTKUDOS Auditor" \
216 wire-fee now x-taler-bank TESTKUDOS:0.01 TESTKUDOS:0.01 \ 239 wire-fee now iban TESTKUDOS:0.01 TESTKUDOS:0.01 \
217 upload &> taler-exchange-offline.log 240 upload &> taler-exchange-offline.log
218 241
219echo -n "." 242echo -n "."
@@ -345,17 +368,17 @@ fi
345echo -en $COLOR$BOLD"Withdrawing amount to wallet ..."$NORM$NOCOLOR 368echo -en $COLOR$BOLD"Withdrawing amount to wallet ..."$NORM$NOCOLOR
346 369
347rm $WALLET_DB 370rm $WALLET_DB
348taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api 'withdrawTestBalance' \ 371taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api --expect-success 'withdrawTestBalance' \
349 "$(jq -n ' 372 "$(jq -n '
350 { 373 {
351 amount: "TESTKUDOS:40", 374 amount: "TESTKUDOS:40",
352 bankBaseUrl: $BANK_URL, 375 bankBaseUrl: $BANK_URL,
353 exchangeBaseUrl: $EXCHANGE_URL 376 exchangeBaseUrl: $EXCHANGE_URL
354 }' \ 377 }' \
355 --arg BANK_URL "$BANK_URL" \ 378 --arg BANK_URL "${BANK_URL}demobanks/default/access-api/" \
356 --arg EXCHANGE_URL "$EXCHANGE_URL" 379 --arg EXCHANGE_URL "$EXCHANGE_URL"
357 )" 2>wallet.err >wallet.log 380 )" 2>wallet-withdraw.err >wallet-withdraw.log
358taler-wallet-cli --wallet-db=$WALLET_DB run-until-done 2>wallet.err >wallet.log 381taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB run-until-done 2>wallet-withdraw-finish.err >wallet-withdraw-finish.log
359 382
360echo " OK" 383echo " OK"
361 384
@@ -366,12 +389,12 @@ do
366 PAY_URI=`jq --argjson INDEX $INDEX -r -e '.payments[$INDEX]' < $TFILE` 389 PAY_URI=`jq --argjson INDEX $INDEX -r -e '.payments[$INDEX]' < $TFILE`
367 # run wallet CLI 390 # run wallet CLI
368 echo -n "$INDEX" 391 echo -n "$INDEX"
369 taler-wallet-cli --wallet-db=$WALLET_DB handle-uri $PAY_URI -y 2>wallet.err >wallet.log 392 taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB handle-uri ${PAY_URI} -y 2>wallet-pay1.err >wallet-pay1.log
370 echo -n "," 393 echo -n ","
371done 394done
372echo " OK" 395echo " OK"
373echo -e $COLOR$BOLD"Running wallet run-pending..."$NORM$NOCOLOR 396echo -e $COLOR$BOLD"Running wallet run-pending..."$NORM$NOCOLOR
374taler-wallet-cli --wallet-db=$WALLET_DB run-pending 2>wallet.err >wallet.log 397taler-wallet-cli --wallet-db=$WALLET_DB run-pending 2>wallet-pay-finish.err >wallet-pay-finish.log
375echo -e $COLOR$BOLD"Payments done"$NORM$NOCOLOR 398echo -e $COLOR$BOLD"Payments done"$NORM$NOCOLOR
376 399
377 400
@@ -398,12 +421,12 @@ do
398 # run wallet CLI 421 # run wallet CLI
399 export PAY_URI 422 export PAY_URI
400 echo -n "$INDEX" 423 echo -n "$INDEX"
401 taler-wallet-cli --wallet-db=$WALLET_DB handle-uri $PAY_URI -y 2>wallet.err >wallet.log 424 taler-wallet-cli --wallet-db=$WALLET_DB handle-uri $PAY_URI -y 2>wallet-pay2-$INDEX.err >wallet-pay2-$INDEX.log
402 echo -n "," 425 echo -n ","
403done 426done
404echo " OK" 427echo " OK"
405echo -e $COLOR$BOLD"Running wallet run-pending..."$NORM$NOCOLOR 428echo -e $COLOR$BOLD"Running wallet run-pending..."$NORM$NOCOLOR
406taler-wallet-cli --wallet-db=$WALLET_DB run-pending 2>wallet.err >wallet.log 429taler-wallet-cli --wallet-db=$WALLET_DB run-pending 2>wallet-pay2-finish.err >wallet-pay2-finish.log
407echo -e $COLOR$BOLD"Payments done"$NORM$NOCOLOR 430echo -e $COLOR$BOLD"Payments done"$NORM$NOCOLOR
408 431
409echo -en $COLOR$BOLD"Try to upload again ..."$NORM$NOCOLOR 432echo -en $COLOR$BOLD"Try to upload again ..."$NORM$NOCOLOR
@@ -422,5 +445,5 @@ fi
422jq -r -e .core_secret < $UFILE > /dev/null && exit_fail "'core_secret' was not cleared upon success" 445jq -r -e .core_secret < $UFILE > /dev/null && exit_fail "'core_secret' was not cleared upon success"
423 446
424echo " OK" 447echo " OK"
425 448rm -f $TALER_DB
426exit 0 449exit 0