mirror of
https://github.com/ntop/n2n.git
synced 2024-09-19 16:41:11 +02:00
Add quick Json API test for edge
This commit is contained in:
parent
ecaba980ba
commit
004ef6eaaf
47
scripts/test_integration_edge.sh
Executable file
47
scripts/test_integration_edge.sh
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/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
|
||||||
|
docmd ${BINDIR}/supernode -v
|
||||||
|
|
||||||
|
# Start the edge in the background
|
||||||
|
docmd sudo ${BINDIR}/edge -l localhost:7654 -c test >/dev/null
|
||||||
|
# TODO:
|
||||||
|
# - send edge messages to stderr?
|
||||||
|
|
||||||
|
docmd ${TOPDIR}/scripts/n2n-ctl communities
|
||||||
|
docmd ${TOPDIR}/scripts/n2n-ctl packetstats
|
||||||
|
docmd ${TOPDIR}/scripts/n2n-ctl edges --raw
|
||||||
|
|
||||||
|
# TODO:
|
||||||
|
# docmd ${TOPDIR}/scripts/n2n-ctl supernodes --raw
|
||||||
|
# - need fixed mac address
|
||||||
|
# - need to mask out:
|
||||||
|
# - version string
|
||||||
|
# - last_seen timestamp
|
||||||
|
# - uptime
|
||||||
|
|
||||||
|
docmd ${TOPDIR}/scripts/n2n-ctl verbose
|
||||||
|
docmd ${TOPDIR}/scripts/n2n-ctl -k $AUTH --write verbose 1
|
||||||
|
|
||||||
|
# looks strange, but we are querying the state of the "stop" verb
|
||||||
|
docmd ${TOPDIR}/scripts/n2n-ctl stop
|
||||||
|
|
||||||
|
# stop them both
|
||||||
|
docmd ${TOPDIR}/scripts/n2n-ctl -k $AUTH --write stop
|
||||||
|
docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 -k $AUTH --write stop
|
||||||
|
|
71
tests/test_integration_edge.sh.expected
Normal file
71
tests/test_integration_edge.sh.expected
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
###
|
||||||
|
|
||||||
|
###
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"community": "test"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
###
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"rx_pkt": 0,
|
||||||
|
"tx_pkt": 2,
|
||||||
|
"type": "transop"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rx_pkt": 0,
|
||||||
|
"tx_pkt": 0,
|
||||||
|
"type": "p2p"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rx_pkt": 0,
|
||||||
|
"tx_pkt": 2,
|
||||||
|
"type": "super"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rx_pkt": 0,
|
||||||
|
"tx_pkt": 2,
|
||||||
|
"type": "super_broadcast"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
###
|
||||||
|
[]
|
||||||
|
|
||||||
|
###
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"traceLevel": 2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
###
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"traceLevel": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
###
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"keep_running": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
###
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"keep_running": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
###
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"keep_running": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
|
@ -2,3 +2,4 @@
|
||||||
# The integration tests
|
# The integration tests
|
||||||
|
|
||||||
test_integration_supernode.sh
|
test_integration_supernode.sh
|
||||||
|
test_integration_edge.sh
|
||||||
|
|
Loading…
Reference in New Issue
Block a user