From 2c37b22d7005e8f18e6f58c9569326644dbe764e Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Tue, 18 Aug 2020 16:52:11 -0600 Subject: [PATCH] tests: add fixture & test for VRF topology learning --- executor-scripts/linux/vrf | 3 +++ tests/fixtures/vrf.interfaces | 7 +++++++ tests/ifquery_test | 8 +++++++- tests/test_env.sh | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/vrf.interfaces diff --git a/executor-scripts/linux/vrf b/executor-scripts/linux/vrf index 3f3d552..c42b000 100755 --- a/executor-scripts/linux/vrf +++ b/executor-scripts/linux/vrf @@ -23,6 +23,9 @@ post-down) [ -n "$IF_VRF_TABLE" ] && handle_init "del" exit 0 ;; +depend) + echo "$IF_VRF_MEMBER" + ;; *) exit 0 ;; diff --git a/tests/fixtures/vrf.interfaces b/tests/fixtures/vrf.interfaces new file mode 100644 index 0000000..bfcf11b --- /dev/null +++ b/tests/fixtures/vrf.interfaces @@ -0,0 +1,7 @@ +iface vrf-red + vrf-table 1 + +auto eth0 +iface eth0 + use dhcp + vrf-member vrf-red diff --git a/tests/ifquery_test b/tests/ifquery_test index 64e8718..0b557d7 100755 --- a/tests/ifquery_test +++ b/tests/ifquery_test @@ -18,7 +18,8 @@ tests_init \ learned_executor \ inheritance_0 \ inheritance_1 \ - implicit_vlan + implicit_vlan \ + vrf_dependency noargs_body() { atf_check -s exit:1 -e ignore ifquery -S/dev/null @@ -112,3 +113,8 @@ implicit_vlan_body() { -o match:"use vlan" \ ifquery -E $EXECUTORS -i $FIXTURES/vlan.interfaces eth0.8 } + +vrf_dependency_body() { + atf_check -s exit:0 -o match:"requires vrf-red" \ + ifquery -E $EXECUTORS_LINUX -i $FIXTURES/vrf.interfaces eth0 +} diff --git a/tests/test_env.sh b/tests/test_env.sh index ff44cfa..870dc86 100644 --- a/tests/test_env.sh +++ b/tests/test_env.sh @@ -1,6 +1,7 @@ PATH="$(atf_get_srcdir)/..:$(atf_get_srcdir)/../..:$PATH" FIXTURES="$(atf_get_srcdir)/fixtures" EXECUTORS="$(atf_get_srcdir)/executors" +EXECUTORS_LINUX="$(atf_get_srcdir)/../executor-scripts/linux" tests_init() { TESTS="$@"