summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorMS <ms@taler.net>2023-02-08 16:36:38 +0100
committerMS <ms@taler.net>2023-02-08 16:36:38 +0100
commit4995252f12d42705718e08535cf88c78ed0c615c (patch)
tree35c82396be3fc19b10de6c26f1d3d8805c4c3d17 /cli
parent6726bb63376a074dd5c8a4af0f17d80150d097fd (diff)
downloadlibeufin-4995252f12d42705718e08535cf88c78ed0c615c.tar.gz
libeufin-4995252f12d42705718e08535cf88c78ed0c615c.tar.bz2
libeufin-4995252f12d42705718e08535cf88c78ed0c615c.zip
tests
adding a convenience script that launches both Sandbox and Nexus setting up a EBICS connection, to ease manual tests.
Diffstat (limited to 'cli')
-rwxr-xr-xcli/tests/launch_services.sh103
1 files changed, 103 insertions, 0 deletions
diff --git a/cli/tests/launch_services.sh b/cli/tests/launch_services.sh
new file mode 100755
index 00000000..369b9bed
--- /dev/null
+++ b/cli/tests/launch_services.sh
@@ -0,0 +1,103 @@
+#!/bin/bash
+
+# Convenience script to setup and run a Sandbox + Nexus
+# EBICS pair, in order to try CLI commands.
+set -eu
+
+function exit_cleanup()
+{
+ echo "Running exit-cleanup"
+ for n in `jobs -p`
+ do
+ kill $n 2> /dev/null || true
+ done
+ wait || true
+ echo "DONE"
+}
+
+trap "exit_cleanup" EXIT
+echo RUNNING SANDBOX-NEXUS EBICS PAIR
+jq --version &> /dev/null || (echo "'jq' command not found"; exit 77)
+curl --version &> /dev/null || (echo "'curl' command not found"; exit 77)
+
+DB_PATH=/tmp/libeufin-cli-test.sqlite3
+export LIBEUFIN_SANDBOX_DB_CONNECTION=jdbc:sqlite:$DB_PATH
+
+echo -n Delete previous data...
+rm -f $DB_PATH
+echo DONE
+echo -n Configure the default demobank with MANA...
+libeufin-sandbox config --currency MANA default
+echo DONE
+echo -n Start the bank...
+export LIBEUFIN_SANDBOX_ADMIN_PASSWORD=foo
+libeufin-sandbox serve &> sandbox.log &
+SANDBOX_PID=$!
+echo DONE
+echo -n Wait for the bank...
+curl --max-time 2 --retry-connrefused --retry-delay 1 --retry 10 http://localhost:5000/ &> /dev/null
+echo DONE
+echo -n Make one superuser at Nexus...
+export LIBEUFIN_NEXUS_DB_CONNECTION=jdbc:sqlite:$DB_PATH
+libeufin-nexus superuser test-user --password x
+echo DONE
+echo -n Launching Nexus...
+libeufin-nexus serve &> nexus.log &
+NEXUS_PID=$!
+echo DONE
+echo -n Waiting for Nexus...
+curl --max-time 2 --retry-connrefused --retry-delay 1 --retry 10 http://localhost:5001/ &> /dev/null
+echo DONE
+
+echo -n "Register the 'www' Sandbox account..."
+export LIBEUFIN_SANDBOX_USERNAME=www
+export LIBEUFIN_SANDBOX_PASSWORD=foo
+libeufin-cli \
+ sandbox --sandbox-url http://localhost:5000/ \
+ demobank \
+ register
+echo DONE
+export LIBEUFIN_SANDBOX_USERNAME=admin
+export LIBEUFIN_SANDBOX_PASSWORD=foo
+echo -n "Create EBICS host at Sandbox..."
+libeufin-cli sandbox \
+ --sandbox-url http://localhost:5000 \
+ ebicshost create --host-id wwwebics
+echo OK
+echo -n "Create 'www' EBICS subscriber at Sandbox..."
+libeufin-cli sandbox \
+ --sandbox-url http://localhost:5000 \
+ demobank new-ebicssubscriber --host-id wwwebics \
+ --user-id wwwebics --partner-id wwwpartner \
+ --bank-account www # that's a username _and_ a bank account name
+echo OK
+export LIBEUFIN_NEXUS_USERNAME=test-user
+export LIBEUFIN_NEXUS_PASSWORD=x
+export LIBEUFIN_NEXUS_URL=http://localhost:5001
+echo -n Creating the EBICS connection at Nexus...
+libeufin-cli connections new-ebics-connection \
+ --ebics-url "http://localhost:5000/ebicsweb" \
+ --host-id wwwebics \
+ --partner-id wwwpartner \
+ --ebics-user-id wwwebics \
+ wwwconn
+echo DONE
+echo -n Setup EBICS keying...
+libeufin-cli connections connect wwwconn > /dev/null
+echo OK
+echo -n Download bank account name from Sandbox...
+libeufin-cli connections download-bank-accounts wwwconn
+echo OK
+echo -n Importing bank account info into Nexus...
+libeufin-cli connections import-bank-account \
+ --offered-account-id www \
+ --nexus-bank-account-id www-nexus \
+ wwwconn
+echo OK
+echo -n Create the Taler facade at Nexus...
+libeufin-cli facades \
+ new-taler-wire-gateway-facade \
+ --currency TESTKUDOS --facade-name test-facade \
+ wwwconn www-nexus
+echo OK
+read -p "Press Enter to terminate..."