Skip to content

Commit

Permalink
fix validation and add more messages on what is going on
Browse files Browse the repository at this point in the history
  • Loading branch information
ylebre committed Nov 16, 2022
1 parent d1f0a3c commit 623fc23
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions test-prejournal.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,63 @@
#!/bin/bash
docker-compose up -d

echo "--- Initializing timeld"
export TIMELD_PASSWORD=`docker exec -it federation-tests_timeld-cli_1 "/usr/local/bin/node" "/timeld/init.mjs"`
echo "--- Extracted key: $TIMELD_PASSWORD"

echo "--- Installing tikiwiki"
docker exec -u www-data -it federation-tests_tikiwiki_1 "/bin/sh" "/usr/local/bin/tiki-init.sh"
echo "--- Setting up environment for prejournal"
cp prejournal/testnet.env testnet.env
echo "TIMELD_PASSWORD=$TIMELD_PASSWORD" >> testnet.env
docker cp testnet.env federation-tests_prejournal_1:/app/.env
curl -d'["alice","alice123"]' http://localhost:8280/v1/register

export FEDERATED_ENTRY_DESCRIPTION="This is the description to check for"
echo "Entering timesheet entry"
curl -d'["23 Sep 2022","stichting","Federated Timesheets", 8, "This is the description to check for"]' http://alice:alice123@localhost:8280/v1/worked-hours

echo "Fetching report from timeld"
docker exec -it federation-tests_timeld-cli_1 "/usr/local/bin/node" "/timeld/report.mjs" > timeld-report.txt
echo "Fetching report from tikiwiki"
curl -H "Authorization: Bearer testnet-supersecret-token" http://localhost:8180/api/trackers/1 > tiki-report.json

TIMELD_VALIDATED=`grep -c "$FEDERATED_ENTRY_DESCRIPTION" timeld-report.txt`
TIKI_VALIDATED=`grep -c "$FEDERATED_ENTRY_DESCRIPTION" tiki-report.json`
TIMELD_VALIDATED=`grep -c "This is the description to check for" timeld-report.txt`
TIKI_VALIDATED=`grep -c "This is the description to check for" tiki-report.json`

if [ $TIMELD_VALIDATED ]
if [ $TIMELD_VALIDATED == '1' ]
then
echo
echo "------------------------------"
echo "Federation to TimeLD validated"
echo "------------------------------"
echo
else
echo
echo "------------------------------"
echo "Federation to TimeLD failed"
echo "------------------------------"
echo
fi
if [ $TIKI_VALIDATED ]
if [ $TIKI_VALIDATED == '1' ]
then
echo
echo "--------------------------------"
echo "Federation to tikiwiki validated"
echo "--------------------------------"
echo
else
echo
echo "--------------------------------"
echo "Federation to tikiwiki failed"
echo "--------------------------------"
echo
fi

rm testnet.env
rm timeld-report.txt
rm tiki-report.json
docker-compose down
if [ $TIMELD_VALIDATED ] && [ $TIKI_VALIDATED ]
if [ $TIMELD_VALIDATED == '1' ] && [ $TIKI_VALIDATED == '1' ]
then
echo
echo "-----------------------------------"
Expand Down

0 comments on commit 623fc23

Please sign in to comment.