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/node-stats.sh

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

72 lines
1.5 KiB
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
2017-09-05 01:07:11 +02:00
#
2021-09-22 10:42:03 +02:00
# Integration loopback test using villas node.
2017-09-05 01:07:11 +02:00
#
# Author: Steffen Vogel <post@steffenvogel.de>
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0
2017-09-05 01:07:11 +02:00
set -e
DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
}
trap finish EXIT
2019-02-17 22:24:49 +01:00
RATE="33.0"
2017-09-05 01:07:11 +02:00
cat > config.json <<EOF
2017-09-05 01:07:11 +02:00
{
"nodes": {
"stats_1": {
"type": "stats",
"node": "signal_1",
"rate": 10.0,
"in": {
"signals": [
{ "name": "gap", "stats": "signal_1.gap_sent.mean" },
{ "name": "total", "stats": "signal_1.owd.total" }
]
}
},
"signal_1": {
"type": "signal",
"limit": 100,
"signal": "sine",
"rate": ${RATE},
"in": {
"hooks": [
{ "type": "stats", "verbose": true }
]
}
},
"stats_log_1": {
"type": "file",
"format": "json",
2019-02-17 22:24:49 +01:00
"uri": "stats.json"
}
},
"paths": [
{
"in": "signal_1"
},
{
"in": "stats_1",
"out": "stats_log_1"
}
]
2017-09-05 01:07:11 +02:00
}
EOF
timeout --preserve-status -k 15s 5s \
villas node config.json
2019-02-17 22:24:49 +01:00
[ -s stats.json ] # check that file exists
2019-02-17 22:24:49 +01:00
tail -n1 stats.json | jq -e "(.data[0] - 1/${RATE} | length) < 1e-4 and .data[1] == 99" > /dev/null