tests: add tests for fallback netmask handling

This commit is contained in:
Ariadne Conill 2020-07-25 01:06:21 -06:00
parent d582e405b6
commit 492e9e7038
4 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,5 @@
auto eth0
iface eth0
address 203.0.113.2
netmask 255.255.255.248
gateway 203.0.113.1

View file

@ -0,0 +1,5 @@
auto eth0
iface eth0
address 2001:db8:1000:2::2
netmask 112
gateway 2001:db8:1000:2::1

View file

@ -7,7 +7,9 @@ tests_init \
lo_always_auto \ lo_always_auto \
dual_stack \ dual_stack \
static_ipv4 \ static_ipv4 \
static_ipv4_netmask \
static_ipv6 \ static_ipv6 \
static_ipv6_netmask \
inet_dhcp \ inet_dhcp \
use_dhcp \ use_dhcp \
alias_eth0_home \ alias_eth0_home \
@ -43,6 +45,15 @@ static_ipv4_body() {
ifdown -S/dev/null -i $FIXTURES/static-eth0-v4.interfaces -n -a ifdown -S/dev/null -i $FIXTURES/static-eth0-v4.interfaces -n -a
} }
static_ipv4_netmask_body() {
atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev lo' \
-o match:'ip link set down dev eth0' \
-o match:'del 203.0.113.2/29 dev eth0' \
-o match:'default via 203.0.113.1' \
ifdown -S/dev/null -i $FIXTURES/static-eth0-v4-netmask.interfaces -n -a
}
static_ipv6_body() { static_ipv6_body() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev lo' \ -o match:'ip link set down dev lo' \
@ -52,6 +63,15 @@ static_ipv6_body() {
ifdown -S/dev/null -i $FIXTURES/static-eth0-v6.interfaces -n -a ifdown -S/dev/null -i $FIXTURES/static-eth0-v6.interfaces -n -a
} }
static_ipv6_netmask_body() {
atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev lo' \
-o match:'ip link set down dev eth0' \
-o match:'del 2001:db8:1000:2::2/112 dev eth0' \
-o match:'default via 2001:db8:1000:2::1' \
ifdown -S/dev/null -i $FIXTURES/static-eth0-v6-netmask.interfaces -n -a
}
inet_dhcp_body() { inet_dhcp_body() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev lo' \ -o match:'ip link set down dev lo' \

View file

@ -7,7 +7,9 @@ tests_init \
lo_always_auto \ lo_always_auto \
dual_stack \ dual_stack \
static_ipv4 \ static_ipv4 \
static_ipv4_netmask \
static_ipv6 \ static_ipv6 \
static_ipv6_netmask \
inet_dhcp \ inet_dhcp \
use_dhcp \ use_dhcp \
alias_eth0_home \ alias_eth0_home \
@ -43,6 +45,15 @@ static_ipv4_body() {
ifup -S/dev/null -i $FIXTURES/static-eth0-v4.interfaces -n -a ifup -S/dev/null -i $FIXTURES/static-eth0-v4.interfaces -n -a
} }
static_ipv4_netmask_body() {
atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev lo' \
-o match:'ip link set up dev eth0' \
-o match:'add 203.0.113.2/29 dev eth0' \
-o match:'default via 203.0.113.1' \
ifup -S/dev/null -i $FIXTURES/static-eth0-v4-netmask.interfaces -n -a
}
static_ipv6_body() { static_ipv6_body() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev lo' \ -o match:'ip link set up dev lo' \
@ -52,6 +63,15 @@ static_ipv6_body() {
ifup -S/dev/null -i $FIXTURES/static-eth0-v6.interfaces -n -a ifup -S/dev/null -i $FIXTURES/static-eth0-v6.interfaces -n -a
} }
static_ipv6_netmask_body() {
atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev lo' \
-o match:'ip link set up dev eth0' \
-o match:'add 2001:db8:1000:2::2/112 dev eth0' \
-o match:'default via 2001:db8:1000:2::1' \
ifup -S/dev/null -i $FIXTURES/static-eth0-v6-netmask.interfaces -n -a
}
inet_dhcp_body() { inet_dhcp_body() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev lo' \ -o match:'ip link set up dev lo' \