mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
tests: use ports > 1024 in order to run without superuser privs
This commit is contained in:
parent
dc350c83f1
commit
8a5aba08f4
5 changed files with 20 additions and 6 deletions
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"http" : {
|
||||
"port" : 8080
|
||||
},
|
||||
"nodes" : {
|
||||
"node1" : {
|
||||
"type" : "loopback"
|
||||
|
|
|
@ -29,6 +29,9 @@ FETCHED_NODES=$(mktemp)
|
|||
|
||||
cat > ${CONFIG_FILE} <<EOF
|
||||
{
|
||||
"http" : {
|
||||
"port" : 8080
|
||||
},
|
||||
"nodes" : {
|
||||
"testnode1" : {
|
||||
"type" : "websocket",
|
||||
|
@ -56,7 +59,7 @@ villas-node ${CONFIG_FILE} &
|
|||
sleep 1
|
||||
|
||||
# Fetch config via API
|
||||
curl -sX POST --data '{ "action" : "nodes", "id" : "5a786626-fbc6-4c04-98c2-48027e68c2fa" }' http://localhost/api/v1 > ${FETCHED_NODES}
|
||||
curl -sX POST --data '{ "action" : "nodes", "id" : "5a786626-fbc6-4c04-98c2-48027e68c2fa" }' http://localhost:8080/api/v1 > ${FETCHED_NODES}
|
||||
|
||||
# Shutdown VILLASnode
|
||||
kill $!
|
||||
|
|
|
@ -29,6 +29,9 @@ FETCHED_CONF=$(mktemp)
|
|||
|
||||
cat <<EOF > ${LOCAL_CONF}
|
||||
{
|
||||
"http" : {
|
||||
"port" : 8080
|
||||
},
|
||||
"nodes" : {
|
||||
"node1" : {
|
||||
"type" : "socket",
|
||||
|
@ -61,7 +64,7 @@ villas-node &
|
|||
sleep 0.2
|
||||
|
||||
# Restart with configuration
|
||||
curl -sX POST --data '{ "action" : "restart", "request" : { "config": "'${LOCAL_CONF}'" }, "id" : "5a786626-fbc6-4c04-98c2-48027e68c2fa" }' http://localhost/api/v1
|
||||
curl -sX POST --data '{ "action" : "restart", "request" : { "config": "'${LOCAL_CONF}'" }, "id" : "5a786626-fbc6-4c04-98c2-48027e68c2fa" }' http://localhost:8080/api/v1
|
||||
|
||||
# Wait for node to complete init
|
||||
sleep 1
|
||||
|
|
|
@ -25,15 +25,20 @@
|
|||
set -e
|
||||
|
||||
# Start without a configuration
|
||||
timeout -s SIGKILL 3 villas-node &
|
||||
timeout -s SIGKILL 3 villas-node & <<EOF
|
||||
{
|
||||
"http" : {
|
||||
"port" : 8080
|
||||
}
|
||||
EOF
|
||||
|
||||
# Wait for node to complete init
|
||||
sleep 1
|
||||
|
||||
# Restart with configuration
|
||||
curl -sX POST --data '{ "action" : "shutdown", "id" : "5a786626-fbc6-4c04-98c2-48027e68c2fa" }' http://localhost/api/v1
|
||||
curl -sX POST --data '{ "action" : "shutdown", "id" : "5a786626-fbc6-4c04-98c2-48027e68c2fa" }' http://localhost:8080/api/v1
|
||||
|
||||
# Wait returns the return code of villas-node
|
||||
# which will be 0 (success) in case of normal shutdown
|
||||
# or <>0 (fail) in case the 3 second timeout was reached
|
||||
wait $!
|
||||
wait $!
|
||||
|
|
|
@ -56,7 +56,7 @@ for J in {1..${RUNS}}; do
|
|||
|
||||
FETCHED_CONF=$(mktemp)
|
||||
|
||||
curl -sX POST --data '{ "action" : "config", "id" : "'$(uuidgen)'" }' http://localhost/api/v1 > ${FETCHED_CONF}
|
||||
curl -sX POST --data '{ "action" : "config", "id" : "'$(uuidgen)'" }' http://localhost:8080/api/v1 > ${FETCHED_CONF}
|
||||
diff -u <(jq -S .response < ${FETCHED_CONF}) <(jq -S . < ${LOCAL_CONF})
|
||||
RC=$?
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue