From 023805105217fbbd0bd09d356b53c91a9cb3ceb3 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Wed, 19 Aug 2020 03:22:44 -0600 Subject: [PATCH] tests: add tunnel executor tests --- tests/linux/Kyuafile | 1 + tests/linux/tunnel_test | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 tests/linux/tunnel_test diff --git a/tests/linux/Kyuafile b/tests/linux/Kyuafile index 471a8ff..99ad1e8 100644 --- a/tests/linux/Kyuafile +++ b/tests/linux/Kyuafile @@ -8,3 +8,4 @@ atf_test_program{name='dhcp_test'} atf_test_program{name='static_test'} atf_test_program{name='vrf_test'} atf_test_program{name='ppp_test'} +atf_test_program{name='tunnel_test'} diff --git a/tests/linux/tunnel_test b/tests/linux/tunnel_test new file mode 100755 index 0000000..c469a78 --- /dev/null +++ b/tests/linux/tunnel_test @@ -0,0 +1,30 @@ +#!/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=pre-up IF_TUNNEL_TYPE=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 tunnel add tun0" \ + -o match:"type '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=post-down IF_TUNNEL_TYPE=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 tunnel del tun0" \ + ${EXECUTOR} +}