diff --git a/tests/integration/api-restart.sh b/tests/integration/api-restart.sh index ec80896ae..0b3f02614 100755 --- a/tests/integration/api-restart.sh +++ b/tests/integration/api-restart.sh @@ -24,6 +24,7 @@ set -e +BASE_CONF=$(mktemp) LOCAL_CONF=$(mktemp) FETCHED_CONF=$(mktemp) @@ -57,20 +58,28 @@ cat < ${LOCAL_CONF} } EOF -# Start without a configuration -villas-node & +cat < ${BASE_CONF} +{ + "http" : { + "port" : 8080 + } +} +EOF + +# Start with base configuration +villas-node ${BASE_CONF} & # Wait for node to complete init -sleep 0.2 +sleep 1 # Restart with configuration 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 +sleep 2 # Fetch config via API -curl -sX POST --data '{ "action" : "config", "id" : "5a786626-fbc6-4c04-98c2-48027e68c2fa" }' http://localhost/api/v1 > ${FETCHED_CONF} +curl -sX POST --data '{ "action" : "config", "id" : "5a786626-fbc6-4c04-98c2-48027e68c2fa" }' http://localhost:8080/api/v1 > ${FETCHED_CONF} # Shutdown VILLASnode kill %% @@ -79,6 +88,6 @@ kill %% diff -u <(jq -S .response < ${FETCHED_CONF}) <(jq -S . < ${LOCAL_CONF}) RC=$? -rm -f ${LOCAL_CONF} ${FETCHED_CONF} +rm -f ${LOCAL_CONF} ${FETCHED_CONF} ${BASE_CONF} exit $RC diff --git a/tests/integration/api-shutdown.sh b/tests/integration/api-shutdown.sh index c5bb442c2..1f1d385e1 100755 --- a/tests/integration/api-shutdown.sh +++ b/tests/integration/api-shutdown.sh @@ -24,20 +24,27 @@ set -e -# Start without a configuration -timeout -s SIGKILL 3 villas-node & < ${CONFIG_FILE} <0 (fail) in case the 3 second timeout was reached