tests: migrate to mock link executor

This commit is contained in:
Ariadne Conill 2020-07-26 03:34:04 -06:00
parent 52d2bad3b8
commit e046ea6a24
3 changed files with 25 additions and 44 deletions

1
tests/executors/link Symbolic link
View file

@ -0,0 +1 @@
mock-executor

View file

@ -21,69 +21,62 @@ noargs_body() {
} }
lo_always_auto_body() { lo_always_auto_body() {
atf_check -s exit:0 -e ignore -o match:'ip link set down dev lo' \ atf_check -s exit:0 -e ignore -o match:'executors/link' \
ifdown -S/dev/null -i/dev/null -n -a ifdown -S/dev/null -E $EXECUTORS -i/dev/null -n -a
} }
dual_stack_body() { dual_stack_body() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev lo' \ -o match:'executors/link' \
-o match:'ip link set down dev eth0' \
-o match:'executors/static' \ -o match:'executors/static' \
ifdown -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev lo' \ -o match:'executors/link' \
-o match:'ip link set down dev eth0' \
-o match:'executors/static' \ -o match:'executors/static' \
ifdown -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev lo' \ -o match:'executors/link' \
-o match:'ip link set down dev eth0' \
-o match:'executors/static' \ -o match:'executors/static' \
ifdown -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev lo' \ -o match:'executors/link' \
-o match:'ip link set down dev eth0' \
-o match:'executors/static' \ -o match:'executors/static' \
ifdown -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev lo' \ -o match:'executors/link' \
-o match:'ip link set down dev eth0' \
-o match:'executors/static' \ -o match:'executors/static' \
ifdown -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev lo' \ -o match:'executors/link' \
-o match:'ip link set down dev eth0' \
-o match:'executors/dhcp' \ -o match:'executors/dhcp' \
ifdown -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev lo' \ -o match:'executors/link' \
-o match:'ip link set down dev eth0' \
-o match:'executors/dhcp' \ -o match:'executors/dhcp' \
ifdown -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev wlan0' \ -o match:'executors/link' \
-o match:'executors/dhcp' \ -o match:'executors/dhcp' \
ifdown -S $FIXTURES/alias-home.ifstate \ ifdown -S $FIXTURES/alias-home.ifstate \
-E $EXECUTORS -i $FIXTURES/alias-home-work.interfaces -n wlan0 -E $EXECUTORS -i $FIXTURES/alias-home-work.interfaces -n wlan0
@ -91,7 +84,7 @@ alias_eth0_home_body() {
alias_eth0_work_body() { alias_eth0_work_body() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev wlan0' \ -o match:'executors/link' \
-o match:'executors/static' \ -o match:'executors/static' \
ifdown -S $FIXTURES/alias-work.ifstate \ ifdown -S $FIXTURES/alias-work.ifstate \
-E $EXECUTORS -i $FIXTURES/alias-home-work.interfaces -n wlan0 -E $EXECUTORS -i $FIXTURES/alias-home-work.interfaces -n wlan0
@ -99,10 +92,7 @@ alias_eth0_work_body() {
bonded_bridge_body() { bonded_bridge_body() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev eth0' \ -o match:'executors/link' \
-o match:'ip link set down dev eth1' \
-o match:'ip link set down dev bond0' \
-o match:'ip link set down dev br0' \
-o match:'executors/bond' \ -o match:'executors/bond' \
-o match:'executors/bridge' \ -o match:'executors/bridge' \
-o match:'executors/static' \ -o match:'executors/static' \

View file

@ -21,86 +21,76 @@ noargs_body() {
} }
lo_always_auto_body() { lo_always_auto_body() {
atf_check -s exit:0 -e ignore -o match:'ip link set up dev lo' \ atf_check -s exit:0 -e ignore -o match:'executors/link' \
ifup -S/dev/null -i/dev/null -n -a ifup -S/dev/null -E $EXECUTORS -i/dev/null -n -a
} }
dual_stack_body() { dual_stack_body() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev lo' \ -o match:'executors/link' \
-o match:'ip link set up dev eth0' \
-o match:'executors/static' \ -o match:'executors/static' \
ifup -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev lo' \ -o match:'executors/link' \
-o match:'ip link set up dev eth0' \
-o match:'executors/static' \ -o match:'executors/static' \
ifup -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev lo' \ -o match:'executors/link' \
-o match:'ip link set up dev eth0' \
-o match:'executors/static' \ -o match:'executors/static' \
ifup -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev lo' \ -o match:'executors/link' \
-o match:'ip link set up dev eth0' \
-o match:'executors/static' \ -o match:'executors/static' \
ifup -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev lo' \ -o match:'executors/link' \
-o match:'ip link set up dev eth0' \
-o match:'executors/static' \ -o match:'executors/static' \
ifup -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev lo' \ -o match:'executors/link' \
-o match:'ip link set up dev eth0' \
-o match:'executors/dhcp' \ -o match:'executors/dhcp' \
ifup -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev lo' \ -o match:'executors/link' \
-o match:'ip link set up dev eth0' \
-o match:'executors/dhcp' \ -o match:'executors/dhcp' \
ifup -S/dev/null -E $EXECUTORS -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:'executors/link' \
-o match:'executors/dhcp' \ -o match:'executors/dhcp' \
ifup -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev wlan0' \ -o match:'executors/link' \
-o match:'executors/static' \ -o match:'executors/static' \
ifup -S/dev/null -E $EXECUTORS -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() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev eth0' \ -o match:'executors/link' \
-o match:'ip link set up dev eth1' \
-o match:'ip link set up dev bond0' \
-o match:'ip link set up dev br0' \
-o match:'executors/bond' \ -o match:'executors/bond' \
-o match:'executors/bridge' \ -o match:'executors/bridge' \
-o match:'executors/static' \ -o match:'executors/static' \