tests: add tests for forward executor
This commit is contained in:
parent
1c2fddfbaa
commit
ffcf1976b8
3 changed files with 93 additions and 0 deletions
|
@ -15,3 +15,5 @@ yesno() {
|
|||
|
||||
[ -n "$IF_FORWARD_IPV4_MC" ] && ${MOCK} /bin/sh -c "echo $(yesno $IF_FORWARD_IPV4_MC) > /proc/sys/net/ipv4/conf/$IFACE/mc_forwarding"
|
||||
[ -n "$IF_FORWARD_IPV6_MC" ] && ${MOCK} /bin/sh -c "echo $(yesno $IF_FORWARD_IPV6_MC) > /proc/sys/net/ipv6/conf/$IFACE/mc_forwarding"
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -13,3 +13,4 @@ atf_test_program{name='gre_test'}
|
|||
atf_test_program{name='wireguard_test'}
|
||||
atf_test_program{name='ethtool_test'}
|
||||
atf_test_program{name='vxlan_test'}
|
||||
atf_test_program{name='forward_test'}
|
||||
|
|
90
tests/linux/forward_test
Executable file
90
tests/linux/forward_test
Executable file
|
@ -0,0 +1,90 @@
|
|||
#!/usr/bin/env atf-sh
|
||||
|
||||
. $(atf_get_srcdir)/../test_env.sh
|
||||
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/forward"
|
||||
|
||||
tests_init \
|
||||
up_forward_v4 \
|
||||
up_forward_v6 \
|
||||
up_forward_v4_mc \
|
||||
up_forward_v6_mc
|
||||
|
||||
up_forward_v4_body() {
|
||||
export IF_FORWARD_IPV4= IF_FORWARD_IPV6= IF_FORWARD_IPV4_MC= IF_FORWARD_IPV6_MC=
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV4=1
|
||||
atf_check -s exit:0 -o match:'echo 1 > /proc/sys/net/ipv4/conf/eth0/forwarding' \
|
||||
${EXECUTOR}
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV4=yes
|
||||
atf_check -s exit:0 -o match:'echo 1 > /proc/sys/net/ipv4/conf/eth0/forwarding' \
|
||||
${EXECUTOR}
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV4=0
|
||||
atf_check -s exit:0 -o match:'echo 0 > /proc/sys/net/ipv4/conf/eth0/forwarding' \
|
||||
${EXECUTOR}
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV4=no
|
||||
atf_check -s exit:0 -o match:'echo 0 > /proc/sys/net/ipv4/conf/eth0/forwarding' \
|
||||
${EXECUTOR}
|
||||
}
|
||||
|
||||
up_forward_v6_body() {
|
||||
export IF_FORWARD_IPV4= IF_FORWARD_IPV6= IF_FORWARD_IPV4_MC= IF_FORWARD_IPV6_MC=
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV6=1
|
||||
atf_check -s exit:0 -o match:'echo 1 > /proc/sys/net/ipv6/conf/eth0/forwarding' \
|
||||
${EXECUTOR}
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV6=yes
|
||||
atf_check -s exit:0 -o match:'echo 1 > /proc/sys/net/ipv6/conf/eth0/forwarding' \
|
||||
${EXECUTOR}
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV6=0
|
||||
atf_check -s exit:0 -o match:'echo 0 > /proc/sys/net/ipv6/conf/eth0/forwarding' \
|
||||
${EXECUTOR}
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV6=no
|
||||
atf_check -s exit:0 -o match:'echo 0 > /proc/sys/net/ipv6/conf/eth0/forwarding' \
|
||||
${EXECUTOR}
|
||||
}
|
||||
|
||||
up_forward_v4_mc_body() {
|
||||
export IF_FORWARD_IPV4= IF_FORWARD_IPV6= IF_FORWARD_IPV4_MC= IF_FORWARD_IPV6_MC=
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV4_MC=1
|
||||
atf_check -s exit:0 -o match:'echo 1 > /proc/sys/net/ipv4/conf/eth0/mc_forwarding' \
|
||||
${EXECUTOR}
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV4_MC=yes
|
||||
atf_check -s exit:0 -o match:'echo 1 > /proc/sys/net/ipv4/conf/eth0/mc_forwarding' \
|
||||
${EXECUTOR}
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV4_MC=0
|
||||
atf_check -s exit:0 -o match:'echo 0 > /proc/sys/net/ipv4/conf/eth0/mc_forwarding' \
|
||||
${EXECUTOR}
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV4_MC=no
|
||||
atf_check -s exit:0 -o match:'echo 0 > /proc/sys/net/ipv4/conf/eth0/mc_forwarding' \
|
||||
${EXECUTOR}
|
||||
}
|
||||
|
||||
up_forward_v6_mc_body() {
|
||||
export IF_FORWARD_IPV4= IF_FORWARD_IPV6= IF_FORWARD_IPV4_MC= IF_FORWARD_IPV6_MC=
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV6_MC=1
|
||||
atf_check -s exit:0 -o match:'echo 1 > /proc/sys/net/ipv6/conf/eth0/mc_forwarding' \
|
||||
${EXECUTOR}
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV6_MC=yes
|
||||
atf_check -s exit:0 -o match:'echo 1 > /proc/sys/net/ipv6/conf/eth0/mc_forwarding' \
|
||||
${EXECUTOR}
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV6_MC=0
|
||||
atf_check -s exit:0 -o match:'echo 0 > /proc/sys/net/ipv6/conf/eth0/mc_forwarding' \
|
||||
${EXECUTOR}
|
||||
|
||||
export IFACE=eth0 PHASE=up MOCK=echo IF_FORWARD_IPV6_MC=no
|
||||
atf_check -s exit:0 -o match:'echo 0 > /proc/sys/net/ipv6/conf/eth0/mc_forwarding' \
|
||||
${EXECUTOR}
|
||||
}
|
Loading…
Reference in a new issue