Skip to content

Commit

Permalink
add environment variables. cat the result from the remotes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ylebre committed Nov 16, 2022
1 parent 797bc0e commit 6dc03e8
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions test-prejournal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,29 @@ 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

echo "Entering timesheet entry"
echo "--- Connecting prejournal to tiki and timeld"
echo "WIKI_TOKEN=testnet-supersecret-token" >> testnet.env
echo "WIKI_HOST=http://tikiwiki.local/api/tabulars" >> testnet.env
echo "WIKI_TABULAR_ID=3" >> testnet.env
echo "TIMELD_HOST=http://timeld-gateway.local:8080/api" >> testnet.env
echo "TIMELD_USERNAME=prejournal" >> testnet.env
echo "TIMELD_TIMESHEET=prejournal/timesheet" >> testnet.env
echo "TIMELD_PROJECT=prejournal/timesheet-project" >> testnet.env
echo "TIMELD_PASSWORD=$TIMELD_PASSWORD" >> testnet.env
docker cp testnet.env federation-tests_prejournal_1:/app/.env

echo "--- Entering timesheet entry in prejournal"
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"
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"
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 "This is the description to check for" timeld-report.txt`
Expand All @@ -30,33 +41,38 @@ then
echo "------------------------------"
echo "Federation to TimeLD validated"
echo "------------------------------"
echo
cat timeld-report.txt
echo "------------------------------"
else
echo
echo "------------------------------"
echo "Federation to TimeLD failed"
echo "------------------------------"
echo
cat timeld-report.txt
echo "------------------------------"
fi
if [ $TIKI_VALIDATED == '1' ]
then
echo
echo "--------------------------------"
echo "Federation to tikiwiki validated"
echo "--------------------------------"
echo
cat tiki-report.json
echo "--------------------------------"
else
echo
echo "--------------------------------"
echo "Federation to tikiwiki failed"
echo "--------------------------------"
echo
cat tiki-report.json
echo "--------------------------------"
fi

rm testnet.env
rm timeld-report.txt
rm tiki-report.json
docker-compose down

if [ $TIMELD_VALIDATED == '1' ] && [ $TIKI_VALIDATED == '1' ]
then
echo
Expand Down

0 comments on commit 6dc03e8

Please sign in to comment.