ifupdown-ng/tests/linux/tunnel_test
Maximilian Wilhelm d9e78e14fb tests: Update tests to reflect create/destroy phase.
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2020-09-10 00:49:04 +02:00

30 lines
762 B
Text
Executable file

#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/../test_env.sh
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/tunnel"
tests_init \
tunnel_bringup \
tunnel_teardown
tunnel_bringup_body() {
export MOCK=echo IFACE=tun0 PHASE=create IF_TUNNEL_MODE=gre \
IF_TUNNEL_LOCAL=1.2.3.4 IF_TUNNEL_REMOTE=5.6.7.8 \
IF_TUNNEL_TTL=255
atf_check -s exit:0 \
-o match:"ip -4 tunnel add tun0" \
-o match:"mode 'gre'" \
-o match:"ttl '255'" \
-o match:"local '1.2.3.4'" \
-o match:"remote '5.6.7.8'" \
${EXECUTOR}
}
tunnel_teardown_body() {
export MOCK=echo IFACE=tun0 PHASE=destroy IF_TUNNEL_MODE=gre \
IF_TUNNEL_LOCAL=1.2.3.4 IF_TUNNEL_REMOTE=5.6.7.8 \
IF_TUNNEL_TTL=255
atf_check -s exit:0 \
-o match:"ip -4 tunnel del tun0" \
${EXECUTOR}
}