diff --git a/executor-scripts/linux/bond b/executor-scripts/linux/bond index 8264e6e..bff2d05 100755 --- a/executor-scripts/linux/bond +++ b/executor-scripts/linux/bond @@ -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 ;; diff --git a/tests/linux/Kyuafile b/tests/linux/Kyuafile index ed28100..ef000f7 100644 --- a/tests/linux/Kyuafile +++ b/tests/linux/Kyuafile @@ -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'} diff --git a/tests/linux/bond_test b/tests/linux/bond_test new file mode 100755 index 0000000..916e09b --- /dev/null +++ b/tests/linux/bond_test @@ -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} +}