d9e78e14fb
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
39 lines
848 B
Text
Executable file
39 lines
848 B
Text
Executable file
#!/usr/bin/env atf-sh
|
|
|
|
. $(atf_get_srcdir)/../test_env.sh
|
|
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/wireguard"
|
|
|
|
tests_init \
|
|
create \
|
|
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}
|
|
}
|
|
|
|
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
|
|
atf_check -s exit:0 \
|
|
-o match:'ip link delete dev wg0' \
|
|
${EXECUTOR}
|
|
}
|