mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
tests: fix integration test node-stats
This commit is contained in:
parent
95dafe15da
commit
fa5a770b30
1 changed files with 33 additions and 12 deletions
|
@ -24,42 +24,51 @@
|
|||
|
||||
SCRIPT=$(realpath $0)
|
||||
SCRIPTPATH=$(dirname ${SCRIPT})
|
||||
source ${SCRIPTPATH}/../../tools/integration-tests-helper.sh
|
||||
source ${SCRIPTPATH}/../../tools/villas-helper.sh
|
||||
|
||||
CONFIG_FILE=$(mktemp)
|
||||
STATS_LOG=$(mktemp)
|
||||
|
||||
RATE="33.0"
|
||||
|
||||
cat > ${CONFIG_FILE} <<EOF
|
||||
{
|
||||
"stats": 1.0,
|
||||
"nodes": {
|
||||
"stats_1": {
|
||||
"type": "stats",
|
||||
"node": "signal_1",
|
||||
"rate": 1.0
|
||||
"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,
|
||||
"rate": 10.0,
|
||||
"rate": ${RATE},
|
||||
"in" : {
|
||||
"hooks": [
|
||||
{ "type": "stats", "verbose": true }
|
||||
]
|
||||
}
|
||||
},
|
||||
"stats_log_1": {
|
||||
"type": "file",
|
||||
"format": "json",
|
||||
|
||||
"uri": "${STATS_LOG}"
|
||||
}
|
||||
},
|
||||
"paths": [
|
||||
{
|
||||
"in": "signal_1",
|
||||
"hooks" : [
|
||||
{ "type" : "print", "enabled" : false }
|
||||
]
|
||||
"in": "signal_1"
|
||||
},
|
||||
{
|
||||
"in": "stats_1",
|
||||
"hooks" : [
|
||||
{ "type" : "print" }
|
||||
]
|
||||
"out": "stats_log_1"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -67,4 +76,16 @@ EOF
|
|||
|
||||
# Start node
|
||||
VILLAS_LOG_PREFIX=$(colorize "[Node] ") \
|
||||
villas-node ${CONFIG_FILE}
|
||||
villas-node ${CONFIG_FILE} &
|
||||
PID=$!
|
||||
|
||||
sleep 5
|
||||
|
||||
kill ${PID}
|
||||
|
||||
tail -n1 ${STATS_LOG} | jq -e "(.data[0] - 1/${RATE} | length) < 1e-4 and .data[1] == 99" > /dev/null
|
||||
RC=$?
|
||||
|
||||
rm ${STATS_LOG} ${CONFIG_FILE}
|
||||
|
||||
exit ${RC}
|
||||
|
|
Loading…
Add table
Reference in a new issue