From 0de4a3f6f925237293e0427147e8dba9c635eb00 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Tue, 4 Aug 2020 13:08:30 -0600 Subject: [PATCH] tests: add ifup/ifdown/ifquery tests for vlans --- tests/fixtures/vlan.ifstate | 2 ++ tests/ifdown_test | 10 +++++++++- tests/ifquery_test | 9 ++++++++- tests/ifup_test | 10 +++++++++- 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 tests/fixtures/vlan.ifstate diff --git a/tests/fixtures/vlan.ifstate b/tests/fixtures/vlan.ifstate new file mode 100644 index 0000000..e360c74 --- /dev/null +++ b/tests/fixtures/vlan.ifstate @@ -0,0 +1,2 @@ +eth0=eth0 +eth0.8=eth0.8 diff --git a/tests/ifdown_test b/tests/ifdown_test index 2d06865..e54d148 100755 --- a/tests/ifdown_test +++ b/tests/ifdown_test @@ -17,7 +17,8 @@ tests_init \ bonded_bridge \ learned_dependency \ learned_dependency_2 \ - learned_executor + learned_executor \ + implicit_vlan noargs_body() { atf_check -s exit:1 -e ignore ifdown -S/dev/null @@ -132,3 +133,10 @@ learned_executor_body() { -E $EXECUTORS \ -i $FIXTURES/mock-dependency-generator-2.interfaces br0 } + +implicit_vlan_body() { + atf_check -s exit:0 -o ignore \ + -e match:"attempting to run vlan executor" \ + -e match:"attempting to run link executor" \ + ifdown -n -S $FIXTURES/vlan.ifstate -E $EXECUTORS -i $FIXTURES/vlan.interfaces eth0.8 +} diff --git a/tests/ifquery_test b/tests/ifquery_test index 68fa518..64e8718 100755 --- a/tests/ifquery_test +++ b/tests/ifquery_test @@ -17,7 +17,8 @@ tests_init \ learned_dependency_2 \ learned_executor \ inheritance_0 \ - inheritance_1 + inheritance_1 \ + implicit_vlan noargs_body() { atf_check -s exit:1 -e ignore ifquery -S/dev/null @@ -105,3 +106,9 @@ inheritance_1_body() { -o match:"address 2001:db8:1000:2::2/64" \ ifquery -E $EXECUTORS -i $FIXTURES/inheritance.interfaces inherit1 } + +implicit_vlan_body() { + atf_check -s exit:0 -o match:"requires eth0" \ + -o match:"use vlan" \ + ifquery -E $EXECUTORS -i $FIXTURES/vlan.interfaces eth0.8 +} diff --git a/tests/ifup_test b/tests/ifup_test index 311be66..594ab11 100755 --- a/tests/ifup_test +++ b/tests/ifup_test @@ -17,7 +17,8 @@ tests_init \ bonded_bridge \ learned_dependency \ learned_dependency_2 \ - learned_executor + learned_executor \ + implicit_vlan noargs_body() { atf_check -s exit:1 -e ignore ifup -S/dev/null @@ -123,3 +124,10 @@ learned_executor_body() { -e match:"attempting to run mock executor" \ ifup -n -S/dev/null -E $EXECUTORS -i $FIXTURES/mock-dependency-generator-2.interfaces br0 } + +implicit_vlan_body() { + atf_check -s exit:0 -o ignore \ + -e match:"attempting to run vlan executor" \ + -e match:"attempting to run link executor" \ + ifup -n -S/dev/null -E $EXECUTORS -i $FIXTURES/vlan.interfaces eth0.8 +}