tests: add a set of more complicated dependency learning tests

This commit is contained in:
Ariadne Conill 2020-07-29 02:33:00 -06:00
parent edfb91c05f
commit 2be1fa5b0b
5 changed files with 40 additions and 3 deletions

View file

@ -0,0 +1,4 @@
eth0=eth0
eth1=eth1
bond0=bond0
br0=br0

View file

@ -0,0 +1,7 @@
iface br0
use mock-dependency-generator
mock-depends bond0
iface bond0
use mock-dependency-generator
mock-depends eth0 eth1

View file

@ -15,7 +15,8 @@ tests_init \
alias_eth0_home \ alias_eth0_home \
alias_eth0_work \ alias_eth0_work \
bonded_bridge \ bonded_bridge \
learned_dependency learned_dependency \
learned_dependency_2
noargs_body() { noargs_body() {
atf_check -s exit:1 -e ignore ifdown -S/dev/null atf_check -s exit:1 -e ignore ifdown -S/dev/null
@ -112,3 +113,13 @@ learned_dependency_body() {
-E $EXECUTORS \ -E $EXECUTORS \
-i $FIXTURES/mock-dependency-generator.interfaces br0 -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
}

View file

@ -13,7 +13,8 @@ tests_init \
state_query_home \ state_query_home \
state_query_work \ state_query_work \
state_print \ state_print \
learned_dependency learned_dependency \
learned_dependency_2
noargs_body() { noargs_body() {
atf_check -s exit:1 -e ignore ifquery -S/dev/null 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" \ atf_check -s exit:0 -o match:"requires eth0 eth1 eth2 eth3 eth4" \
ifquery -E $EXECUTORS -i $FIXTURES/mock-dependency-generator.interfaces br0 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
}

View file

@ -15,7 +15,8 @@ tests_init \
alias_eth0_home \ alias_eth0_home \
alias_eth0_work \ alias_eth0_work \
bonded_bridge \ bonded_bridge \
learned_dependency learned_dependency \
learned_dependency_2
noargs_body() { noargs_body() {
atf_check -s exit:1 -e ignore ifup -S/dev/null atf_check -s exit:1 -e ignore ifup -S/dev/null
@ -107,3 +108,11 @@ learned_dependency_body() {
-e match:"eth4" \ -e match:"eth4" \
ifup -n -S/dev/null -E $EXECUTORS -i $FIXTURES/mock-dependency-generator.interfaces br0 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
}