clean up integration test shell library
This commit is contained in:
parent
4bd372770e
commit
06aa5abcc7
@ -31,6 +31,9 @@ function setup_config() {
|
|||||||
export CONF=test-${SCRIPT_NAME}.conf
|
export CONF=test-${SCRIPT_NAME}.conf
|
||||||
cp template.conf "$CONF"
|
cp template.conf "$CONF"
|
||||||
|
|
||||||
|
export LOG=test-${SCRIPT_NAME}.log
|
||||||
|
rm "$LOG" 2>/dev/null || true
|
||||||
|
|
||||||
export WALLET_DB=wallet-${SCRIPT_NAME}.json
|
export WALLET_DB=wallet-${SCRIPT_NAME}.json
|
||||||
rm "$WALLET_DB" 2>/dev/null || true
|
rm "$WALLET_DB" 2>/dev/null || true
|
||||||
|
|
||||||
@ -102,8 +105,7 @@ function launch_services() {
|
|||||||
|
|
||||||
function wait_for_services() {
|
function wait_for_services() {
|
||||||
# Wait for bank to be available (usually the slowest)
|
# Wait for bank to be available (usually the slowest)
|
||||||
for _ in $(seq 1 50)
|
for _ in $(seq 1 50); do
|
||||||
do
|
|
||||||
echo -n "."
|
echo -n "."
|
||||||
sleep 0.2
|
sleep 0.2
|
||||||
OK=0
|
OK=0
|
||||||
@ -113,8 +115,7 @@ function wait_for_services() {
|
|||||||
break
|
break
|
||||||
done
|
done
|
||||||
# Wait for all other services to be available
|
# Wait for all other services to be available
|
||||||
for _ in $(seq 1 50)
|
for _ in $(seq 1 50); do
|
||||||
do
|
|
||||||
echo -n "."
|
echo -n "."
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
OK=0
|
OK=0
|
||||||
@ -127,14 +128,20 @@ function wait_for_services() {
|
|||||||
OK=1
|
OK=1
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
if [ 1 != $OK ]
|
if [ 1 != $OK ]; then
|
||||||
then
|
|
||||||
shutdown_services
|
shutdown_services
|
||||||
exit_skip "Failed to launch services"
|
exit_skip "Failed to launch services"
|
||||||
fi
|
fi
|
||||||
echo " DONE"
|
echo " DONE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normal_start_and_wait() {
|
||||||
|
setup_config "$1"
|
||||||
|
setup_services
|
||||||
|
launch_services
|
||||||
|
wait_for_services
|
||||||
|
}
|
||||||
|
|
||||||
function shutdown_services() {
|
function shutdown_services() {
|
||||||
echo "Shutting down services"
|
echo "Shutting down services"
|
||||||
jobs -p | xargs --no-run-if-empty kill || true
|
jobs -p | xargs --no-run-if-empty kill || true
|
||||||
|
@ -4,10 +4,7 @@
|
|||||||
# wallet and merchant.
|
# wallet and merchant.
|
||||||
|
|
||||||
source "common.sh"
|
source "common.sh"
|
||||||
setup_config "base"
|
normal_start_and_wait "base"
|
||||||
setup_services
|
|
||||||
launch_services
|
|
||||||
wait_for_services
|
|
||||||
|
|
||||||
# run wallet CLI
|
# run wallet CLI
|
||||||
echo "Running wallet"
|
echo "Running wallet"
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
# Script to check that Uris are properly handled when used a second time
|
# Script to check that Uris are properly handled when used a second time
|
||||||
|
|
||||||
source "common.sh"
|
source "common.sh"
|
||||||
setup_config "double-link"
|
normal_start_and_wait "double-link"
|
||||||
setup_services
|
|
||||||
launch_services
|
|
||||||
wait_for_services
|
|
||||||
|
|
||||||
echo "Getting pay taler:// Uri"
|
echo "Getting pay taler:// Uri"
|
||||||
PAY_URI=$(taler-wallet-cli testing gen-pay-uri -m "$MERCHANT_URL" -k sandbox -a "TESTKUDOS:1" -s "foo" | grep -E -o 'taler://.*')
|
PAY_URI=$(taler-wallet-cli testing gen-pay-uri -m "$MERCHANT_URL" -k sandbox -a "TESTKUDOS:1" -s "foo" | grep -E -o 'taler://.*')
|
||||||
|
@ -2,10 +2,7 @@
|
|||||||
# Script to check that the wallet can not double spend coins and handles this error well
|
# Script to check that the wallet can not double spend coins and handles this error well
|
||||||
|
|
||||||
source "common.sh"
|
source "common.sh"
|
||||||
setup_config "double-spend"
|
normal_start_and_wait "double-spend"
|
||||||
setup_services
|
|
||||||
launch_services
|
|
||||||
wait_for_services
|
|
||||||
|
|
||||||
echo "Withdraw TESTKUDOS"
|
echo "Withdraw TESTKUDOS"
|
||||||
taler-wallet-cli --wallet-db="$WALLET_DB" --no-throttle testing withdraw -e "$EXCHANGE_URL" -b "$BANK_URL" -a "TESTKUDOS:10" >/dev/null
|
taler-wallet-cli --wallet-db="$WALLET_DB" --no-throttle testing withdraw -e "$EXCHANGE_URL" -b "$BANK_URL" -a "TESTKUDOS:10" >/dev/null
|
||||||
|
Loading…
Reference in New Issue
Block a user