tests: Update tests to reflect create/destroy phase.
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
parent
af94d760d0
commit
d9e78e14fb
6 changed files with 35 additions and 29 deletions
|
@ -9,7 +9,7 @@ tests_init \
|
||||||
flags_bringup
|
flags_bringup
|
||||||
|
|
||||||
basic_bringup_body() {
|
basic_bringup_body() {
|
||||||
export MOCK=echo IFACE=tun0 PHASE=pre-up \
|
export MOCK=echo IFACE=tun0 PHASE=create \
|
||||||
IF_GRE_LOCAL=1.2.3.4 IF_GRE_REMOTE=5.6.7.8 \
|
IF_GRE_LOCAL=1.2.3.4 IF_GRE_REMOTE=5.6.7.8 \
|
||||||
IF_GRE_TTL=255
|
IF_GRE_TTL=255
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
|
@ -22,7 +22,7 @@ basic_bringup_body() {
|
||||||
}
|
}
|
||||||
|
|
||||||
basic_teardown_body() {
|
basic_teardown_body() {
|
||||||
export MOCK=echo IFACE=tun0 PHASE=post-down \
|
export MOCK=echo IFACE=tun0 PHASE=destroy \
|
||||||
IF_GRE_LOCAL=1.2.3.4 IF_GRE_REMOTE=5.6.7.8 \
|
IF_GRE_LOCAL=1.2.3.4 IF_GRE_REMOTE=5.6.7.8 \
|
||||||
IF_GRE_TTL=255
|
IF_GRE_TTL=255
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
|
@ -31,7 +31,7 @@ basic_teardown_body() {
|
||||||
}
|
}
|
||||||
|
|
||||||
flags_bringup_body() {
|
flags_bringup_body() {
|
||||||
export MOCK=echo IFACE=tun0 PHASE=pre-up \
|
export MOCK=echo IFACE=tun0 PHASE=create \
|
||||||
IF_GRE_LOCAL=1.2.3.4 IF_GRE_REMOTE=5.6.7.8 \
|
IF_GRE_LOCAL=1.2.3.4 IF_GRE_REMOTE=5.6.7.8 \
|
||||||
IF_GRE_TTL=255 IF_GRE_FLAGS="nopmtudisc ignore-df"
|
IF_GRE_TTL=255 IF_GRE_FLAGS="nopmtudisc ignore-df"
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
|
|
|
@ -8,13 +8,13 @@ tests_init \
|
||||||
down \
|
down \
|
||||||
mtu \
|
mtu \
|
||||||
hwaddress \
|
hwaddress \
|
||||||
vlan_explicit_pre_up \
|
vlan_explicit_create \
|
||||||
vlan_explicit_post_down \
|
vlan_explicit_destroy \
|
||||||
vlan_guessed_pre_up \
|
vlan_guessed_create \
|
||||||
vlan_guessed_post_down \
|
vlan_guessed_destroy \
|
||||||
vlan_explicit_depend \
|
vlan_explicit_depend \
|
||||||
vlan_guessed_depend \
|
vlan_guessed_depend \
|
||||||
dummy_pre_up
|
dummy_create
|
||||||
|
|
||||||
up_body() {
|
up_body() {
|
||||||
export IFACE=lo PHASE=up MOCK=echo
|
export IFACE=lo PHASE=up MOCK=echo
|
||||||
|
@ -40,28 +40,28 @@ hwaddress_body() {
|
||||||
${EXECUTOR}
|
${EXECUTOR}
|
||||||
}
|
}
|
||||||
|
|
||||||
vlan_explicit_pre_up_body() {
|
vlan_explicit_create_body() {
|
||||||
export IFACE=servers PHASE=pre-up MOCK=echo \
|
export IFACE=servers PHASE=create MOCK=echo \
|
||||||
IF_VLAN_RAW_DEVICE="eth0" IF_VLAN_ID="123"
|
IF_VLAN_RAW_DEVICE="eth0" IF_VLAN_ID="123"
|
||||||
atf_check -s exit:0 -o match:'ip link add link eth0 name servers type vlan id 123' \
|
atf_check -s exit:0 -o match:'ip link add link eth0 name servers type vlan id 123' \
|
||||||
${EXECUTOR}
|
${EXECUTOR}
|
||||||
}
|
}
|
||||||
|
|
||||||
vlan_explicit_post_down_body() {
|
vlan_explicit_destroy_body() {
|
||||||
export IFACE=servers PHASE=post-down MOCK=echo \
|
export IFACE=servers PHASE=destroy MOCK=echo \
|
||||||
IF_VLAN_RAW_DEVICE="eth0" IF_VLAN_ID="123"
|
IF_VLAN_RAW_DEVICE="eth0" IF_VLAN_ID="123"
|
||||||
atf_check -s exit:0 -o match:'ip link del servers' \
|
atf_check -s exit:0 -o match:'ip link del servers' \
|
||||||
${EXECUTOR}
|
${EXECUTOR}
|
||||||
}
|
}
|
||||||
|
|
||||||
vlan_guessed_pre_up_body() {
|
vlan_guessed_create_body() {
|
||||||
export IFACE=eth0.8 PHASE=pre-up MOCK=echo
|
export IFACE=eth0.8 PHASE=create MOCK=echo
|
||||||
atf_check -s exit:0 -o match:'ip link add link eth0 name eth0.8 type vlan id 8' \
|
atf_check -s exit:0 -o match:'ip link add link eth0 name eth0.8 type vlan id 8' \
|
||||||
${EXECUTOR}
|
${EXECUTOR}
|
||||||
}
|
}
|
||||||
|
|
||||||
vlan_guessed_post_down_body() {
|
vlan_guessed_destroy_body() {
|
||||||
export IFACE=eth0.8 PHASE=post-down MOCK=echo
|
export IFACE=eth0.8 PHASE=destroy MOCK=echo
|
||||||
atf_check -s exit:0 -o match:'ip link del eth0.8' \
|
atf_check -s exit:0 -o match:'ip link del eth0.8' \
|
||||||
${EXECUTOR}
|
${EXECUTOR}
|
||||||
}
|
}
|
||||||
|
@ -79,8 +79,8 @@ vlan_guessed_depend_body() {
|
||||||
${EXECUTOR}
|
${EXECUTOR}
|
||||||
}
|
}
|
||||||
|
|
||||||
dummy_pre_up_body() {
|
dummy_create_body() {
|
||||||
export IFACE=yolo IF_LINK_TYPE=dummy PHASE=pre-up MOCK=echo
|
export IFACE=yolo IF_LINK_TYPE=dummy PHASE=create MOCK=echo
|
||||||
atf_check -s exit:0 -o match:'ip link add yolo type dummy' \
|
atf_check -s exit:0 -o match:'ip link add yolo type dummy' \
|
||||||
${EXECUTOR}
|
${EXECUTOR}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,14 @@ tests_init \
|
||||||
teardown \
|
teardown \
|
||||||
|
|
||||||
bringup_body() {
|
bringup_body() {
|
||||||
export MOCK=echo IFACE=ppp0 PHASE=pre-up IF_PPP_PROVIDER=someisp
|
export MOCK=echo IFACE=ppp0 PHASE=create IF_PPP_PROVIDER=someisp
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
-o match:'pon someisp' \
|
-o match:'pon someisp' \
|
||||||
${EXECUTOR}
|
${EXECUTOR}
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown_body() {
|
teardown_body() {
|
||||||
export MOCK=echo IFACE=ppp0 PHASE=post-down IF_PPP_PROVIDER=someisp
|
export MOCK=echo IFACE=ppp0 PHASE=destroy IF_PPP_PROVIDER=someisp
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
-o match:'poff someisp' \
|
-o match:'poff someisp' \
|
||||||
${EXECUTOR}
|
${EXECUTOR}
|
||||||
|
|
|
@ -8,7 +8,7 @@ tests_init \
|
||||||
tunnel_teardown
|
tunnel_teardown
|
||||||
|
|
||||||
tunnel_bringup_body() {
|
tunnel_bringup_body() {
|
||||||
export MOCK=echo IFACE=tun0 PHASE=pre-up IF_TUNNEL_MODE=gre \
|
export MOCK=echo IFACE=tun0 PHASE=create IF_TUNNEL_MODE=gre \
|
||||||
IF_TUNNEL_LOCAL=1.2.3.4 IF_TUNNEL_REMOTE=5.6.7.8 \
|
IF_TUNNEL_LOCAL=1.2.3.4 IF_TUNNEL_REMOTE=5.6.7.8 \
|
||||||
IF_TUNNEL_TTL=255
|
IF_TUNNEL_TTL=255
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
|
@ -21,7 +21,7 @@ tunnel_bringup_body() {
|
||||||
}
|
}
|
||||||
|
|
||||||
tunnel_teardown_body() {
|
tunnel_teardown_body() {
|
||||||
export MOCK=echo IFACE=tun0 PHASE=post-down IF_TUNNEL_MODE=gre \
|
export MOCK=echo IFACE=tun0 PHASE=destroy IF_TUNNEL_MODE=gre \
|
||||||
IF_TUNNEL_LOCAL=1.2.3.4 IF_TUNNEL_REMOTE=5.6.7.8 \
|
IF_TUNNEL_LOCAL=1.2.3.4 IF_TUNNEL_REMOTE=5.6.7.8 \
|
||||||
IF_TUNNEL_TTL=255
|
IF_TUNNEL_TTL=255
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
|
|
|
@ -9,7 +9,7 @@ tests_init \
|
||||||
member_bringup
|
member_bringup
|
||||||
|
|
||||||
leader_bringup_body() {
|
leader_bringup_body() {
|
||||||
export MOCK=echo IFACE=vrf-red PHASE=pre-up IF_VRF_TABLE=1 IF_VRF_MEMBER=
|
export MOCK=echo IFACE=vrf-red PHASE=create IF_VRF_TABLE=1 IF_VRF_MEMBER=
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
-o match:'ip link add vrf-red type vrf table 1' \
|
-o match:'ip link add vrf-red type vrf table 1' \
|
||||||
-o match:'ip rule add iif vrf-red table 1' \
|
-o match:'ip rule add iif vrf-red table 1' \
|
||||||
|
@ -18,7 +18,7 @@ leader_bringup_body() {
|
||||||
}
|
}
|
||||||
|
|
||||||
leader_teardown_body() {
|
leader_teardown_body() {
|
||||||
export MOCK=echo IFACE=vrf-red PHASE=post-down IF_VRF_TABLE=1 IF_VRF_MEMBER=
|
export MOCK=echo IFACE=vrf-red PHASE=destroy IF_VRF_TABLE=1 IF_VRF_MEMBER=
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
-o match:'ip link del vrf-red type vrf table 1' \
|
-o match:'ip link del vrf-red type vrf table 1' \
|
||||||
-o match:'ip rule del iif vrf-red table 1' \
|
-o match:'ip rule del iif vrf-red table 1' \
|
||||||
|
|
|
@ -4,14 +4,21 @@
|
||||||
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/wireguard"
|
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/wireguard"
|
||||||
|
|
||||||
tests_init \
|
tests_init \
|
||||||
|
create \
|
||||||
pre_up \
|
pre_up \
|
||||||
pre_up_specified_config \
|
pre_up_specified_config \
|
||||||
post_down
|
destroy
|
||||||
|
|
||||||
|
create_body() {
|
||||||
|
export IFACE=wg0 PHASE=create MOCK=echo
|
||||||
|
atf_check -s exit:0 \
|
||||||
|
-o match:'ip link add wg0 type wireguard' \
|
||||||
|
${EXECUTOR}
|
||||||
|
}
|
||||||
|
|
||||||
pre_up_body() {
|
pre_up_body() {
|
||||||
export IFACE=wg0 PHASE=pre-up MOCK=echo
|
export IFACE=wg0 PHASE=pre-up MOCK=echo
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
-o match:'ip link add wg0 type wireguard' \
|
|
||||||
-o match:'wg setconf wg0 /etc/wireguard/wg0.conf' \
|
-o match:'wg setconf wg0 /etc/wireguard/wg0.conf' \
|
||||||
${EXECUTOR}
|
${EXECUTOR}
|
||||||
}
|
}
|
||||||
|
@ -20,13 +27,12 @@ pre_up_specified_config_body() {
|
||||||
export IFACE=wg0 PHASE=pre-up MOCK=echo \
|
export IFACE=wg0 PHASE=pre-up MOCK=echo \
|
||||||
IF_WIREGUARD_CONFIG_PATH=/etc/wireguard/vpn.conf
|
IF_WIREGUARD_CONFIG_PATH=/etc/wireguard/vpn.conf
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
-o match:'ip link add wg0 type wireguard' \
|
|
||||||
-o match:'wg setconf wg0 /etc/wireguard/vpn.conf' \
|
-o match:'wg setconf wg0 /etc/wireguard/vpn.conf' \
|
||||||
${EXECUTOR}
|
${EXECUTOR}
|
||||||
}
|
}
|
||||||
|
|
||||||
post_down_body() {
|
destroy_body() {
|
||||||
export IFACE=wg0 PHASE=post-down MOCK=echo
|
export IFACE=wg0 PHASE=destroy MOCK=echo
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
-o match:'ip link delete dev wg0' \
|
-o match:'ip link delete dev wg0' \
|
||||||
${EXECUTOR}
|
${EXECUTOR}
|
||||||
|
|
Loading…
Reference in a new issue