tests: add wireguard tests
This commit is contained in:
parent
f32481deb9
commit
acb555b75a
4 changed files with 52 additions and 1 deletions
|
@ -10,3 +10,4 @@ atf_test_program{name='vrf_test'}
|
|||
atf_test_program{name='ppp_test'}
|
||||
atf_test_program{name='tunnel_test'}
|
||||
atf_test_program{name='gre_test'}
|
||||
atf_test_program{name='wireguard_test'}
|
||||
|
|
33
tests/linux/wireguard_test
Executable file
33
tests/linux/wireguard_test
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env atf-sh
|
||||
|
||||
. $(atf_get_srcdir)/../test_env.sh
|
||||
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/wireguard"
|
||||
|
||||
tests_init \
|
||||
pre_up \
|
||||
pre_up_specified_config \
|
||||
post_down
|
||||
|
||||
pre_up_body() {
|
||||
export IFACE=wg0 PHASE=pre-up MOCK=echo
|
||||
atf_check -s exit:0 \
|
||||
-o match:'ip link add wg0 type wireguard' \
|
||||
-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:'ip link add wg0 type wireguard' \
|
||||
-o match:'wg setconf wg0 /etc/wireguard/vpn.conf' \
|
||||
${EXECUTOR}
|
||||
}
|
||||
|
||||
post_down_body() {
|
||||
export IFACE=wg0 PHASE=post-down MOCK=echo
|
||||
atf_check -s exit:0 \
|
||||
-o match:'ip link delete dev wg0' \
|
||||
${EXECUTOR}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue