1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/tests/integration/api-config.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
862 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
2017-04-27 13:08:17 +02:00
#
# Integration test for remote API
#
2022-03-15 09:18:01 -04:00
# Author: Steffen Vogel <post@steffenvogel.de>
2022-03-15 09:28:57 -04:00
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
2022-07-04 18:20:03 +02:00
# SPDX-License-Identifier: Apache-2.0
2017-03-27 12:39:29 +02:00
set -e
2017-04-02 12:56:46 +02:00
DIR=$(mktemp -d)
pushd ${DIR}
2017-03-27 12:39:29 +02:00
function finish {
popd
rm -rf ${DIR}
}
trap finish EXIT
cat > config.json <<EOF
{
"http": {
"port": 8080
},
"nodes": {
"node1": {
"type": "loopback"
}
}
}
EOF
2017-08-20 10:54:34 +02:00
ID=$(uuidgen)
2021-02-16 14:15:14 +01:00
# Start VILLASnode instance with local config
villas node config.json &
2017-03-27 12:39:29 +02:00
2017-04-02 12:56:46 +02:00
# Wait for node to complete init
2017-03-27 12:39:29 +02:00
sleep 1
# Fetch config via API
curl -s http://localhost:8080/api/v2/config > fetched.json
2017-03-27 12:39:29 +02:00
# Shutdown VILLASnode
kill $!
2017-04-02 12:56:46 +02:00
# Compare local config with the fetched one
diff -u <(jq -S . < fetched.json) <(jq -S . < config.json)