tests: add a set of more complicated dependency learning tests
This commit is contained in:
parent
edfb91c05f
commit
2be1fa5b0b
5 changed files with 40 additions and 3 deletions
4
tests/fixtures/mock-dependency-generator-2.ifstate
vendored
Normal file
4
tests/fixtures/mock-dependency-generator-2.ifstate
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
eth0=eth0
|
||||
eth1=eth1
|
||||
bond0=bond0
|
||||
br0=br0
|
7
tests/fixtures/mock-dependency-generator-2.interfaces
vendored
Normal file
7
tests/fixtures/mock-dependency-generator-2.interfaces
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
iface br0
|
||||
use mock-dependency-generator
|
||||
mock-depends bond0
|
||||
|
||||
iface bond0
|
||||
use mock-dependency-generator
|
||||
mock-depends eth0 eth1
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue