From 8e7c935cdf1fd43b0592336d3913cc4b0e8a6e28 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 24 Aug 2020 03:01:38 -0600 Subject: [PATCH] link executor tests: test vlan dependency learning --- executor-scripts/linux/link | 4 +++- tests/linux/link_test | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/executor-scripts/linux/link b/executor-scripts/linux/link index d7cf0ad..aec3a7c 100755 --- a/executor-scripts/linux/link +++ b/executor-scripts/linux/link @@ -56,6 +56,8 @@ up|down) fi ;; depend) - echo "$IF_VLAN_RAW_DEVICE" + if is_vlan; then + echo "$IF_VLAN_RAW_DEVICE" + fi ;; esac diff --git a/tests/linux/link_test b/tests/linux/link_test index def1b43..1cb2784 100755 --- a/tests/linux/link_test +++ b/tests/linux/link_test @@ -10,7 +10,9 @@ tests_init \ vlan_explicit_up \ vlan_explicit_down \ vlan_guessed_up \ - vlan_guessed_down + vlan_guessed_down \ + vlan_explicit_depend \ + vlan_guessed_depend up_body() { export IFACE=lo PHASE=up MOCK=echo @@ -55,3 +57,16 @@ vlan_guessed_down_body() { atf_check -s exit:0 -o match:'ip link delete link eth0 name eth0.8 type vlan id 8' \ ${EXECUTOR} } + +vlan_explicit_depend_body() { + export IFACE=servers PHASE=up MOCK=echo \ + IF_VLAN_RAW_DEVICE="eth0" IF_VLAN_ID="123" + atf_check -s exit:0 -o match:'eth0' \ + ${EXECUTOR} +} + +vlan_guessed_depend_body() { + export IFACE=eth0.8 PHASE=depend + atf_check -s exit:0 -o match:'eth0' \ + ${EXECUTOR} +}