n2n/scripts/test_integration_edge.sh

54 lines
1.2 KiB
Bash
Raw Normal View History

2021-11-06 20:13:42 +01:00
#!/bin/sh
#
# Do some quick tests via the Json API against the edge
#
AUTH=n2n
# boilerplate so we can support whaky cmake dirs
[ -z "$TOPDIR" ] && TOPDIR=.
[ -z "$BINDIR" ] && BINDIR=.
docmd() {
echo "###"
"$@"
echo
}
# start a supernode
2023-06-24 15:34:30 +02:00
docmd "${BINDIR}"/supernode -v
2021-11-06 20:13:42 +01:00
# Start the edge in the background
2023-06-24 15:34:30 +02:00
docmd sudo "${BINDIR}"/edge -l localhost:7654 -c test >/dev/null
2021-11-06 20:13:42 +01:00
# TODO:
# - send edge messages to stderr?
# TODO: probe the api endpoint, waiting for both the supernode and edge to be
# available?
sleep 0.1
2023-06-24 15:34:30 +02:00
docmd "${TOPDIR}"/scripts/n2n-ctl communities
docmd "${TOPDIR}"/scripts/n2n-ctl packetstats
docmd "${TOPDIR}"/scripts/n2n-ctl edges --raw
2021-11-06 20:13:42 +01:00
# TODO:
# docmd ${TOPDIR}/scripts/n2n-ctl supernodes --raw
# - need fixed mac address
# - need to mask out:
# - version string
# - last_seen timestamp
# - uptime
2023-06-24 15:34:30 +02:00
docmd "${TOPDIR}"/scripts/n2n-ctl verbose
docmd "${TOPDIR}"/scripts/n2n-ctl --write verbose 1 2>/dev/null
echo $?
2023-06-24 15:34:30 +02:00
docmd "${TOPDIR}"/scripts/n2n-ctl -k $AUTH --write verbose 1
2021-11-06 20:13:42 +01:00
# looks strange, but we are querying the state of the "stop" verb
2023-06-24 15:34:30 +02:00
docmd "${TOPDIR}"/scripts/n2n-ctl stop
2021-11-06 20:13:42 +01:00
# stop them both
2023-06-24 15:34:30 +02:00
docmd "${TOPDIR}"/scripts/n2n-ctl -k $AUTH --write stop
docmd "${TOPDIR}"/scripts/n2n-ctl -t 5645 -k $AUTH --write stop
2021-11-06 20:13:42 +01:00