tests: add tests for deferred interface teardown (refcounting)

This commit is contained in:
Ariadne Conill 2020-09-08 16:02:24 -06:00
parent f139bc2416
commit 8de83fdd9a
5 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,6 @@
lo=lo 1
br0=br0 1
bond0=bond0 2
eth0=eth0 3
eth1=eth1 2
tun0=tun0 1

View file

@ -0,0 +1,9 @@
auto br0
iface br0
requires bond0
iface bond0
requires eth0 eth1
iface tun0
requires eth0

View file

@ -0,0 +1,5 @@
eth0=eth0 5
tun0=tun0 1
tun1=tun1 1
tun2=tun2 1
tun3=tun3 1

View file

@ -0,0 +1,11 @@
iface tun0
requires eth0
iface tun1
requires eth0
iface tun2
requires eth0
iface tun3
requires eth0

View file

@ -19,6 +19,9 @@ tests_init \
learned_dependency_2 \
learned_executor \
implicit_vlan \
deferred_teardown_1 \
deferred_teardown_2 \
deferred_teardown_3 \
regress_opt_f
noargs_body() {
@ -142,6 +145,33 @@ implicit_vlan_body() {
ifdown -n -S $FIXTURES/vlan.ifstate -E $EXECUTORS -i $FIXTURES/vlan.interfaces eth0.8
}
deferred_teardown_1_body() {
atf_check -s exit:0 -o ignore \
-e match:"skipping dependent interface eth0 \\(of bond0\\) -- transient dependencies still exist" \
-e match:"changing state of dependent interface eth1 \\(of bond0\\) to down" \
ifdown -n -S $FIXTURES/deferred-teardown-1.ifstate -E $EXECUTORS \
-i $FIXTURES/deferred-teardown-1.interfaces br0
}
deferred_teardown_2_body() {
atf_check -s exit:0 -o ignore \
-e match:"skipping dependent interface eth0 \\(of tun0\\) -- transient dependencies still exist" \
-e match:"skipping dependent interface eth0 \\(of tun1\\) -- transient dependencies still exist" \
-e match:"skipping dependent interface eth0 \\(of tun2\\) -- transient dependencies still exist" \
ifdown -n -S $FIXTURES/deferred-teardown-2.ifstate -E $EXECUTORS \
-i $FIXTURES/deferred-teardown-2.interfaces tun0 tun1 tun2
}
deferred_teardown_3_body() {
atf_check -s exit:0 -o ignore \
-e match:"skipping dependent interface eth0 \\(of tun0\\) -- transient dependencies still exist" \
-e match:"skipping dependent interface eth0 \\(of tun1\\) -- transient dependencies still exist" \
-e match:"skipping dependent interface eth0 \\(of tun2\\) -- transient dependencies still exist" \
-e match:"changing state of dependent interface eth0 \\(of tun3\\) to down" \
ifdown -n -S $FIXTURES/deferred-teardown-2.ifstate -E $EXECUTORS \
-i $FIXTURES/deferred-teardown-2.interfaces tun0 tun1 tun2 tun3
}
regress_opt_f_body() {
atf_check -s exit:0 -o ignore -e ignore \
ifdown -n -S $FIXTURES/vlan.ifstate -E $EXECUTORS -i $FIXTURES/vlan.interfaces -f eth0.8