Merge pull request #146 from BarbarossaTM/chore/tests

Add test for bond executor
This commit is contained in:
Maximilian Wilhelm 2021-03-24 15:10:02 +01:00 committed by GitHub
commit 258d397d84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 12 deletions

View file

@ -41,9 +41,9 @@ case "$PHASE" in
# Add members to bundle
for member_iface in ${IF_BOND_MEMBERS}; do
# Work around the current execution order
ip link set "${member_iface}" down
ip link set master "${IFACE}" "${member_iface}"
ip link set "${member_iface}" up
${MOCK} ip link set "${member_iface}" down
${MOCK} ip link set master "${IFACE}" "${member_iface}"
${MOCK} ip link set "${member_iface}" up
done
;;

View file

@ -2,15 +2,16 @@ syntax(2)
test_suite('ifupdown-ng')
atf_test_program{name='link_test'}
atf_test_program{name='ipv6-ra_test'}
atf_test_program{name='bond_test'}
atf_test_program{name='dhcp_test'}
atf_test_program{name='static_test'}
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'}
atf_test_program{name='ethtool_test'}
atf_test_program{name='vxlan_test'}
atf_test_program{name='forward_test'}
atf_test_program{name='gre_test'}
atf_test_program{name='ipv6-ra_test'}
atf_test_program{name='link_test'}
atf_test_program{name='ppp_test'}
atf_test_program{name='static_test'}
atf_test_program{name='tunnel_test'}
atf_test_program{name='vrf_test'}
atf_test_program{name='vxlan_test'}
atf_test_program{name='wireguard_test'}

30
tests/linux/bond_test Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/../test_env.sh
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/bond"
tests_init \
create_lacp_basic \
create_lacp_real
create_lacp_basic_body() {
export IFACE=bond0 PHASE=create MOCK=echo IF_BOND_MODE=802.3ad IF_BOND_MEMBERS="eth0 eth1"
atf_check -s exit:0 \
-o match:'ip link add bond0 type bond mode 802.3ad' \
-o match:'ip link set eth0 down' \
-o match:'ip link set master bond0 eth0' \
-o match:'ip link set eth0 up' \
-o match:'ip link set master bond0 eth1' \
${EXECUTOR}
}
create_lacp_real_body() {
export IFACE=bond0 PHASE=create MOCK=echo IF_BOND_MODE=802.3ad IF_BOND_MEMBERS="eth0 eth1" \
IF_BOND_MIN_LINKS="1" IF_BOND_XMIT_HASH_POLICY="layer3+4"
atf_check -s exit:0 \
-o match:'ip link add bond0 type bond' \
-o match:'mode 802.3ad' \
-o match:'min_links 1' \
-o match:'xmit_hash_policy layer3\+4' \
${EXECUTOR}
}