Skip to content

Commit

Permalink
Add script for testing web interface (not yet integrated in the CI)
Browse files Browse the repository at this point in the history
  • Loading branch information
eudoxos committed Oct 11, 2024
1 parent c2ca415 commit 8afedcb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ run: $(TASKS)
ns:
python3 -m Pyro5.nameserver --port 11001
mongo:
mkdir -p mongodb-tmp~ && /usr/bin/mongod --port 11002 --noauth --dbpath=./mongodb-tmp~ --logpath=/dev/stdout --logappend
mkdir -p mongodb-tmp~ && /usr/bin/mongod --port 11002 --noauth --dbpath=./mongodb-tmp~ --logpath=/dev/null --logappend
rest:
# MUPIFDB_DRY_RUN=1
sleep 2 && cd mupifDB/api && MUPIFDB_MONGODB_PORT=11002 MUPIFDB_REST_SERVER=http://127.0.0.1:11003 MUPIFDB_LOG_LEVEL=DEBUG MUPIFDB_RESTAPI_HOST=localhost MUPIFDB_RESTAPI_PORT=11003 python3 main.py
web:
sleep 7 && cd webapi && MUPIFDB_MONGODB_PORT=11002 MUPIFDB_REST_SERVER=http://127.0.0.1:11003 MUPIFDB_WEB_FAKE_AUTH=1 FLASK_APP=index.py PYTHONPATH=.. python3 -m flask run --host 127.0.0.1 --port 11004
sleep 7 && cd webapi && MUPIFDB_MONGODB_PORT=11002 MUPIFDB_REST_SERVER=http://127.0.0.1:11003 MUPIFDB_WEB_FAKE_AUTH=1 FLASK_APP=index.py PYTHONPATH=.. python3 -m flask run --debug --no-reload --host 127.0.0.1 --port 11004
browse:
sleep 9 && xdg-open http://127.0.0.1:11004
sleep 9 # && xdg-open http://127.0.0.1:11004
scheduler:
sleep 7 && MUPIF_LOG_LEVEL=DEBUG MUPIFDB_REST_SERVER=http://127.0.0.1:11003 MUPIF_NS=localhost:11001 PYTHONPATH=.. python3 -c 'from mupifDB import workflowscheduler as ws; ws.LOOP_SLEEP_SEC=5; ws.schedulerStatFile="./sched-stat.json"; ws.main()'
35 changes: 35 additions & 0 deletions tools/webtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -e -x
##
## simulates web browser: uploading a new workflow, creating execution, waiting for it to finish, checking inputs/outpus, downloading the log
##

export SRV=http://127.0.0.1:11004
export CURL="curl --fail --no-progress-meter -o /dev/null"
if true; then
for WHAT in "" about status usecases workflows workflowexecutions contact workflow_add/1; do
$CURL $SRV/$WHAT
done
fi
# upload a new workflow file to usecase 1 (assuming it exists)
URL=$( curl $SRV/workflow_add/1 -F file_workflow=@../workflows/mini01.py -F file_add_1=@../workflows/workflowdemo01.py -F file_add_2=@../workflows/workflowdemo02.py -o /tmp/aa.html -L -w %{url_effective} )
WID=`echo $URL | cut -d/ -f5`
WVERSION=$( curl $SRV/workflows/$WID --fail --no-progress-meter | grep -Po 'Version:</td><td>\K[0-9]+(?=</td>)' )
# intialize new execution record of the lateest version, get its WEID
WEID=$( $CURL $SRV/workflowexecutions/init/$WID/$WVERSION -L -w %{url_effective} | cut -d/ -f5 )
# set inputs via form (once there are some inputs):
# curl $SRV/workflowexecutions/$WEID/inputs
$CURL $SRV/executeworkflow/$WEID
for i in `seq 20`; do
sleep 1
STATUS=$( curl $SRV/workflowexecutions/$WEID --fail --no-progress-meter | grep -Po 'Status:</td><td>\K[^<]+(?=</td>)' )
if [ "$STATUS" = "Finished" ]; then break; fi
done
[ "$STATUS" == "Finished" ] || exit 1
sleep 1
LOGID=$( curl $SRV/workflowexecutions/$WEID --fail --no-progress-meter | grep -Po 'a href="/file/\K[a-z0-9]+(?="> Execution log</a>)' )
$CURL $SRV/workflowexecutions/$WEID/inputs
$CURL $SRV/workflowexecutions/$WEID/outputs
LOGSIZE=$( $CURL $SRV/file/$LOGID -w %{size_download} )
echo "Logfile is $LOGSIZE bytes."

0 comments on commit 8afedcb

Please sign in to comment.