tests: add ifup/ifdown tests for learned dependencies (close #5)

This commit is contained in:
Ariadne Conill 2020-07-28 14:04:27 -06:00
parent 21bcbe1017
commit cf59f6af4c
3 changed files with 32 additions and 2 deletions

View file

@ -0,0 +1,6 @@
eth0=eth0
eth1=eth1
eth2=eth2
eth3=eth3
eth4=eth4
br0=br0

View file

@ -14,7 +14,8 @@ tests_init \
use_dhcp \ use_dhcp \
alias_eth0_home \ alias_eth0_home \
alias_eth0_work \ alias_eth0_work \
bonded_bridge bonded_bridge \
learned_dependency
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
@ -99,3 +100,15 @@ bonded_bridge_body() {
ifdown -S $FIXTURES/bonded-bridge.ifstate \ ifdown -S $FIXTURES/bonded-bridge.ifstate \
-E $EXECUTORS -i $FIXTURES/bonded-bridge.interfaces -n br0 -E $EXECUTORS -i $FIXTURES/bonded-bridge.interfaces -n br0
} }
learned_dependency_body() {
atf_check -s exit:0 -o ignore \
-e match:"eth0" \
-e match:"eth1" \
-e match:"eth2" \
-e match:"eth3" \
-e match:"eth4" \
ifdown -n -S $FIXTURES/mock-dependency-generator.ifstate \
-E $EXECUTORS \
-i $FIXTURES/mock-dependency-generator.interfaces br0
}

View file

@ -14,7 +14,8 @@ tests_init \
use_dhcp \ use_dhcp \
alias_eth0_home \ alias_eth0_home \
alias_eth0_work \ alias_eth0_work \
bonded_bridge bonded_bridge \
learned_dependency
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
@ -96,3 +97,13 @@ bonded_bridge_body() {
-o match:'executors/static' \ -o match:'executors/static' \
ifup -S/dev/null -E $EXECUTORS -i $FIXTURES/bonded-bridge.interfaces -n br0 ifup -S/dev/null -E $EXECUTORS -i $FIXTURES/bonded-bridge.interfaces -n br0
} }
learned_dependency_body() {
atf_check -s exit:0 -o ignore \
-e match:"eth0" \
-e match:"eth1" \
-e match:"eth2" \
-e match:"eth3" \
-e match:"eth4" \
ifup -n -S/dev/null -E $EXECUTORS -i $FIXTURES/mock-dependency-generator.interfaces br0
}