tests: add tests for use dhcp variant

This commit is contained in:
Ariadne Conill 2020-07-24 05:04:33 -06:00
parent 16af3755e0
commit 7f847ac975
4 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,3 @@
auto eth0
iface eth0
use dhcp

View file

@ -9,6 +9,7 @@ tests_init \
static_ipv4 \ static_ipv4 \
static_ipv6 \ static_ipv6 \
inet_dhcp \ inet_dhcp \
use_dhcp \
alias_eth0_home \ alias_eth0_home \
alias_eth0_work \ alias_eth0_work \
bonded_bridge bonded_bridge
@ -59,6 +60,14 @@ inet_dhcp_body() {
ifdown -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces -n -a ifdown -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces -n -a
} }
use_dhcp_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:'dhc' \
ifdown -S/dev/null -i $FIXTURES/use-dhcp-eth0.interfaces -n -a
}
alias_eth0_home_body() { alias_eth0_home_body() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set down dev wlan0' \ -o match:'ip link set down dev wlan0' \

View file

@ -9,6 +9,7 @@ tests_init \
static_ipv4 \ static_ipv4 \
static_ipv6 \ static_ipv6 \
dhcp_ipv4 \ dhcp_ipv4 \
use_dhcp \
state_query_home \ state_query_home \
state_query_work \ state_query_work \
state_print state_print
@ -47,6 +48,11 @@ dhcp_ipv4_body() {
ifquery -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces eth0 ifquery -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces eth0
} }
use_dhcp_body() {
atf_check -s exit:0 -o match:"use dhcp" \
ifquery -S/dev/null -i $FIXTURES/use-dhcp-eth0.interfaces eth0
}
state_query_home_body() { state_query_home_body() {
atf_check -s exit:0 -o match:"iface home" \ atf_check -s exit:0 -o match:"iface home" \
ifquery -S $FIXTURES/alias-home.ifstate -i $FIXTURES/alias-home-work.interfaces wlan0 ifquery -S $FIXTURES/alias-home.ifstate -i $FIXTURES/alias-home-work.interfaces wlan0

View file

@ -9,6 +9,7 @@ tests_init \
static_ipv4 \ static_ipv4 \
static_ipv6 \ static_ipv6 \
inet_dhcp \ inet_dhcp \
use_dhcp \
alias_eth0_home \ alias_eth0_home \
alias_eth0_work \ alias_eth0_work \
bonded_bridge bonded_bridge
@ -59,6 +60,14 @@ inet_dhcp_body() {
ifup -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces -n -a ifup -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces -n -a
} }
use_dhcp_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:'dhc' \
ifup -S/dev/null -i $FIXTURES/use-dhcp-eth0.interfaces -n -a
}
alias_eth0_home_body() { alias_eth0_home_body() {
atf_check -s exit:0 -e ignore \ atf_check -s exit:0 -e ignore \
-o match:'ip link set up dev wlan0' \ -o match:'ip link set up dev wlan0' \