tests: use mock executors

This commit is contained in:
Ariadne Conill 2020-07-25 02:50:24 -06:00
parent 559bf2d1a4
commit cd8fbb64fb
3 changed files with 21 additions and 20 deletions

View file

@ -33,7 +33,7 @@ dual_stack_body() {
-o match:'del 2001:db8:1000:2::2/64 dev eth0' \ -o match:'del 2001:db8:1000:2::2/64 dev eth0' \
-o match:'default via 203.0.113.1' \ -o match:'default via 203.0.113.1' \
-o match:'default via 2001:db8:1000:2::1' \ -o match:'default via 2001:db8:1000:2::1' \
ifdown -S/dev/null -i $FIXTURES/static-eth0.interfaces -n -a ifdown -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0.interfaces -n -a
} }
static_ipv4_body() { static_ipv4_body() {
@ -42,7 +42,7 @@ static_ipv4_body() {
-o match:'ip link set down dev eth0' \ -o match:'ip link set down dev eth0' \
-o match:'del 203.0.113.2/24 dev eth0' \ -o match:'del 203.0.113.2/24 dev eth0' \
-o match:'default via 203.0.113.1' \ -o match:'default via 203.0.113.1' \
ifdown -S/dev/null -i $FIXTURES/static-eth0-v4.interfaces -n -a ifdown -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v4.interfaces -n -a
} }
static_ipv4_netmask_body() { static_ipv4_netmask_body() {
@ -51,7 +51,7 @@ static_ipv4_netmask_body() {
-o match:'ip link set down dev eth0' \ -o match:'ip link set down dev eth0' \
-o match:'del 203.0.113.2/29 dev eth0' \ -o match:'del 203.0.113.2/29 dev eth0' \
-o match:'default via 203.0.113.1' \ -o match:'default via 203.0.113.1' \
ifdown -S/dev/null -i $FIXTURES/static-eth0-v4-netmask.interfaces -n -a ifdown -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v4-netmask.interfaces -n -a
} }
static_ipv6_body() { static_ipv6_body() {
@ -60,7 +60,7 @@ static_ipv6_body() {
-o match:'ip link set down dev eth0' \ -o match:'ip link set down dev eth0' \
-o match:'del 2001:db8:1000:2::2/64 dev eth0' \ -o match:'del 2001:db8:1000:2::2/64 dev eth0' \
-o match:'default via 2001:db8:1000:2::1' \ -o match:'default via 2001:db8:1000:2::1' \
ifdown -S/dev/null -i $FIXTURES/static-eth0-v6.interfaces -n -a ifdown -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v6.interfaces -n -a
} }
static_ipv6_netmask_body() { static_ipv6_netmask_body() {
@ -69,7 +69,7 @@ static_ipv6_netmask_body() {
-o match:'ip link set down dev eth0' \ -o match:'ip link set down dev eth0' \
-o match:'del 2001:db8:1000:2::2/112 dev eth0' \ -o match:'del 2001:db8:1000:2::2/112 dev eth0' \
-o match:'default via 2001:db8:1000:2::1' \ -o match:'default via 2001:db8:1000:2::1' \
ifdown -S/dev/null -i $FIXTURES/static-eth0-v6-netmask.interfaces -n -a ifdown -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v6-netmask.interfaces -n -a
} }
inet_dhcp_body() { inet_dhcp_body() {
@ -77,7 +77,7 @@ inet_dhcp_body() {
-o match:'ip link set down dev lo' \ -o match:'ip link set down dev lo' \
-o match:'ip link set down dev eth0' \ -o match:'ip link set down dev eth0' \
-o match:'dhc' \ -o match:'dhc' \
ifdown -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces -n -a ifdown -S/dev/null -E $EXECUTORS -i $FIXTURES/dhcp-eth0.interfaces -n -a
} }
use_dhcp_body() { use_dhcp_body() {
@ -85,7 +85,7 @@ use_dhcp_body() {
-o match:'ip link set down dev lo' \ -o match:'ip link set down dev lo' \
-o match:'ip link set down dev eth0' \ -o match:'ip link set down dev eth0' \
-o match:'dhc' \ -o match:'dhc' \
ifdown -S/dev/null -i $FIXTURES/use-dhcp-eth0.interfaces -n -a ifdown -S/dev/null -E $EXECUTORS -i $FIXTURES/use-dhcp-eth0.interfaces -n -a
} }
alias_eth0_home_body() { alias_eth0_home_body() {
@ -93,7 +93,7 @@ alias_eth0_home_body() {
-o match:'ip link set down dev wlan0' \ -o match:'ip link set down dev wlan0' \
-o match:'dhc' \ -o match:'dhc' \
ifdown -S $FIXTURES/alias-home.ifstate \ ifdown -S $FIXTURES/alias-home.ifstate \
-i $FIXTURES/alias-home-work.interfaces -n wlan0 -E $EXECUTORS -i $FIXTURES/alias-home-work.interfaces -n wlan0
} }
alias_eth0_work_body() { alias_eth0_work_body() {
@ -104,7 +104,7 @@ alias_eth0_work_body() {
-o match:'default via 203.0.113.1' \ -o match:'default via 203.0.113.1' \
-o match:'default via 2001:db8:1000:2::1' \ -o match:'default via 2001:db8:1000:2::1' \
ifdown -S $FIXTURES/alias-work.ifstate \ ifdown -S $FIXTURES/alias-work.ifstate \
-i $FIXTURES/alias-home-work.interfaces -n wlan0 -E $EXECUTORS -i $FIXTURES/alias-home-work.interfaces -n wlan0
} }
bonded_bridge_body() { bonded_bridge_body() {
@ -118,5 +118,5 @@ bonded_bridge_body() {
-o match:'default via 203.0.113.1' \ -o match:'default via 203.0.113.1' \
-o match:'default via 2001:db8:1000:2::1' \ -o match:'default via 2001:db8:1000:2::1' \
ifdown -S $FIXTURES/bonded-bridge.ifstate \ ifdown -S $FIXTURES/bonded-bridge.ifstate \
-i $FIXTURES/bonded-bridge.interfaces -n br0 -E $EXECUTORS -i $FIXTURES/bonded-bridge.interfaces -n br0
} }

View file

@ -33,7 +33,7 @@ dual_stack_body() {
-o match:'add 2001:db8:1000:2::2/64 dev eth0' \ -o match:'add 2001:db8:1000:2::2/64 dev eth0' \
-o match:'default via 203.0.113.1' \ -o match:'default via 203.0.113.1' \
-o match:'default via 2001:db8:1000:2::1' \ -o match:'default via 2001:db8:1000:2::1' \
ifup -S/dev/null -i $FIXTURES/static-eth0.interfaces -n -a ifup -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0.interfaces -n -a
} }
static_ipv4_body() { static_ipv4_body() {
@ -42,7 +42,7 @@ static_ipv4_body() {
-o match:'ip link set up dev eth0' \ -o match:'ip link set up dev eth0' \
-o match:'add 203.0.113.2/24 dev eth0' \ -o match:'add 203.0.113.2/24 dev eth0' \
-o match:'default via 203.0.113.1' \ -o match:'default via 203.0.113.1' \
ifup -S/dev/null -i $FIXTURES/static-eth0-v4.interfaces -n -a ifup -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v4.interfaces -n -a
} }
static_ipv4_netmask_body() { static_ipv4_netmask_body() {
@ -51,7 +51,7 @@ static_ipv4_netmask_body() {
-o match:'ip link set up dev eth0' \ -o match:'ip link set up dev eth0' \
-o match:'add 203.0.113.2/29 dev eth0' \ -o match:'add 203.0.113.2/29 dev eth0' \
-o match:'default via 203.0.113.1' \ -o match:'default via 203.0.113.1' \
ifup -S/dev/null -i $FIXTURES/static-eth0-v4-netmask.interfaces -n -a ifup -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v4-netmask.interfaces -n -a
} }
static_ipv6_body() { static_ipv6_body() {
@ -60,7 +60,7 @@ static_ipv6_body() {
-o match:'ip link set up dev eth0' \ -o match:'ip link set up dev eth0' \
-o match:'add 2001:db8:1000:2::2/64 dev eth0' \ -o match:'add 2001:db8:1000:2::2/64 dev eth0' \
-o match:'default via 2001:db8:1000:2::1' \ -o match:'default via 2001:db8:1000:2::1' \
ifup -S/dev/null -i $FIXTURES/static-eth0-v6.interfaces -n -a ifup -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v6.interfaces -n -a
} }
static_ipv6_netmask_body() { static_ipv6_netmask_body() {
@ -69,7 +69,7 @@ static_ipv6_netmask_body() {
-o match:'ip link set up dev eth0' \ -o match:'ip link set up dev eth0' \
-o match:'add 2001:db8:1000:2::2/112 dev eth0' \ -o match:'add 2001:db8:1000:2::2/112 dev eth0' \
-o match:'default via 2001:db8:1000:2::1' \ -o match:'default via 2001:db8:1000:2::1' \
ifup -S/dev/null -i $FIXTURES/static-eth0-v6-netmask.interfaces -n -a ifup -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v6-netmask.interfaces -n -a
} }
inet_dhcp_body() { inet_dhcp_body() {
@ -77,7 +77,7 @@ inet_dhcp_body() {
-o match:'ip link set up dev lo' \ -o match:'ip link set up dev lo' \
-o match:'ip link set up dev eth0' \ -o match:'ip link set up dev eth0' \
-o match:'dhc' \ -o match:'dhc' \
ifup -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces -n -a ifup -S/dev/null -E $EXECUTORS -i $FIXTURES/dhcp-eth0.interfaces -n -a
} }
use_dhcp_body() { use_dhcp_body() {
@ -85,14 +85,14 @@ use_dhcp_body() {
-o match:'ip link set up dev lo' \ -o match:'ip link set up dev lo' \
-o match:'ip link set up dev eth0' \ -o match:'ip link set up dev eth0' \
-o match:'dhc' \ -o match:'dhc' \
ifup -S/dev/null -i $FIXTURES/use-dhcp-eth0.interfaces -n -a ifup -S/dev/null -E $EXECUTORS -i $FIXTURES/use-dhcp-eth0.interfaces -n -a
} }
alias_eth0_home_body() { alias_eth0_home_body() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev wlan0' \ -o match:'ip link set up dev wlan0' \
-o match:'dhc' \ -o match:'dhc' \
ifup -S/dev/null -i $FIXTURES/alias-home-work.interfaces -n wlan0=home ifup -S/dev/null -E $EXECUTORS -i $FIXTURES/alias-home-work.interfaces -n wlan0=home
} }
alias_eth0_work_body() { alias_eth0_work_body() {
@ -102,7 +102,7 @@ alias_eth0_work_body() {
-o match:'add 2001:db8:1000:2::2/64 dev wlan0' \ -o match:'add 2001:db8:1000:2::2/64 dev wlan0' \
-o match:'default via 203.0.113.1' \ -o match:'default via 203.0.113.1' \
-o match:'default via 2001:db8:1000:2::1' \ -o match:'default via 2001:db8:1000:2::1' \
ifup -S/dev/null -i $FIXTURES/alias-home-work.interfaces -n wlan0=work ifup -S/dev/null -E $EXECUTORS -i $FIXTURES/alias-home-work.interfaces -n wlan0=work
} }
bonded_bridge_body() { bonded_bridge_body() {
@ -115,5 +115,5 @@ bonded_bridge_body() {
-o match:'add 2001:db8:1000:2::2/64 dev br0' \ -o match:'add 2001:db8:1000:2::2/64 dev br0' \
-o match:'default via 203.0.113.1' \ -o match:'default via 203.0.113.1' \
-o match:'default via 2001:db8:1000:2::1' \ -o match:'default via 2001:db8:1000:2::1' \
ifup -S/dev/null -i $FIXTURES/bonded-bridge.interfaces -n br0 ifup -S/dev/null -E $EXECUTORS -i $FIXTURES/bonded-bridge.interfaces -n br0
} }

View file

@ -1,5 +1,6 @@
PATH="$(atf_get_srcdir)/..:$PATH" PATH="$(atf_get_srcdir)/..:$PATH"
FIXTURES="$(atf_get_srcdir)/fixtures" FIXTURES="$(atf_get_srcdir)/fixtures"
EXECUTORS="$(atf_get_srcdir)/executors"
tests_init() { tests_init() {
TESTS="$@" TESTS="$@"