diff --git a/tests/fixtures/mock-dependency-generator-2.ifstate b/tests/fixtures/mock-dependency-generator-2.ifstate new file mode 100644 index 0000000..6320c87 --- /dev/null +++ b/tests/fixtures/mock-dependency-generator-2.ifstate @@ -0,0 +1,4 @@ +eth0=eth0 +eth1=eth1 +bond0=bond0 +br0=br0 diff --git a/tests/fixtures/mock-dependency-generator-2.interfaces b/tests/fixtures/mock-dependency-generator-2.interfaces new file mode 100644 index 0000000..1f5708d --- /dev/null +++ b/tests/fixtures/mock-dependency-generator-2.interfaces @@ -0,0 +1,7 @@ +iface br0 + use mock-dependency-generator + mock-depends bond0 + +iface bond0 + use mock-dependency-generator + mock-depends eth0 eth1 diff --git a/tests/ifdown_test b/tests/ifdown_test index dfd4f77..6fbad68 100755 --- a/tests/ifdown_test +++ b/tests/ifdown_test @@ -15,7 +15,8 @@ tests_init \ alias_eth0_home \ alias_eth0_work \ bonded_bridge \ - learned_dependency + learned_dependency \ + learned_dependency_2 noargs_body() { atf_check -s exit:1 -e ignore ifdown -S/dev/null @@ -112,3 +113,13 @@ learned_dependency_body() { -E $EXECUTORS \ -i $FIXTURES/mock-dependency-generator.interfaces br0 } + +learned_dependency_2_body() { + atf_check -s exit:0 -o ignore \ + -e match:"bond0" \ + -e match:"eth0" \ + -e match:"eth1" \ + ifdown -n -S $FIXTURES/mock-dependency-generator-2.ifstate \ + -E $EXECUTORS \ + -i $FIXTURES/mock-dependency-generator-2.interfaces br0 +} diff --git a/tests/ifquery_test b/tests/ifquery_test index 91c1380..0fa5819 100755 --- a/tests/ifquery_test +++ b/tests/ifquery_test @@ -13,7 +13,8 @@ tests_init \ state_query_home \ state_query_work \ state_print \ - learned_dependency + learned_dependency \ + learned_dependency_2 noargs_body() { atf_check -s exit:1 -e ignore ifquery -S/dev/null @@ -75,3 +76,8 @@ learned_dependency_body() { atf_check -s exit:0 -o match:"requires eth0 eth1 eth2 eth3 eth4" \ ifquery -E $EXECUTORS -i $FIXTURES/mock-dependency-generator.interfaces br0 } + +learned_dependency_2_body() { + atf_check -s exit:0 -o match:"requires bond0" \ + ifquery -E $EXECUTORS -i $FIXTURES/mock-dependency-generator-2.interfaces br0 +} diff --git a/tests/ifup_test b/tests/ifup_test index 1a2b4ea..18c4902 100755 --- a/tests/ifup_test +++ b/tests/ifup_test @@ -15,7 +15,8 @@ tests_init \ alias_eth0_home \ alias_eth0_work \ bonded_bridge \ - learned_dependency + learned_dependency \ + learned_dependency_2 noargs_body() { atf_check -s exit:1 -e ignore ifup -S/dev/null @@ -107,3 +108,11 @@ learned_dependency_body() { -e match:"eth4" \ ifup -n -S/dev/null -E $EXECUTORS -i $FIXTURES/mock-dependency-generator.interfaces br0 } + +learned_dependency_2_body() { + atf_check -s exit:0 -o ignore \ + -e match:"bond0" \ + -e match:"eth0" \ + -e match:"eth1" \ + ifup -n -S/dev/null -E $EXECUTORS -i $FIXTURES/mock-dependency-generator-2.interfaces br0 +}