ifupdown-ng/tests/linux/wireguard_test

40 lines
848 B
Text
Raw Permalink Normal View History

2020-09-04 19:10:57 +00:00
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/../test_env.sh
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/wireguard"
tests_init \
create \
2020-09-04 19:10:57 +00:00
pre_up \
pre_up_specified_config \
destroy
create_body() {
export IFACE=wg0 PHASE=create MOCK=echo
atf_check -s exit:0 \
-o match:'ip link add wg0 type wireguard' \
${EXECUTOR}
}
2020-09-04 19:10:57 +00:00
pre_up_body() {
export IFACE=wg0 PHASE=pre-up MOCK=echo
atf_check -s exit:0 \
-o match:'wg setconf wg0 /etc/wireguard/wg0.conf' \
${EXECUTOR}
}
pre_up_specified_config_body() {
export IFACE=wg0 PHASE=pre-up MOCK=echo \
IF_WIREGUARD_CONFIG_PATH=/etc/wireguard/vpn.conf
atf_check -s exit:0 \
-o match:'wg setconf wg0 /etc/wireguard/vpn.conf' \
${EXECUTOR}
}
destroy_body() {
export IFACE=wg0 PHASE=destroy MOCK=echo
2020-09-04 19:10:57 +00:00
atf_check -s exit:0 \
-o match:'ip link delete dev wg0' \
${EXECUTOR}
}