tests: add ifquery state tests
This commit is contained in:
parent
09057aa977
commit
c94c66b25c
4 changed files with 30 additions and 1 deletions
7
tests/fixtures/alias-home-work.interfaces
vendored
Normal file
7
tests/fixtures/alias-home-work.interfaces
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
iface home inet dhcp
|
||||||
|
|
||||||
|
iface work
|
||||||
|
address 203.0.113.2/24
|
||||||
|
address 2001:db8:1000:2::2/64
|
||||||
|
gateway 203.0.113.1
|
||||||
|
gateway 2001:db8:1000:2::1
|
1
tests/fixtures/alias-home.ifstate
vendored
Normal file
1
tests/fixtures/alias-home.ifstate
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
wlan0=home
|
1
tests/fixtures/alias-work.ifstate
vendored
Normal file
1
tests/fixtures/alias-work.ifstate
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
wlan0=work
|
|
@ -8,7 +8,10 @@ tests_init \
|
||||||
static_dual_stack \
|
static_dual_stack \
|
||||||
static_ipv4 \
|
static_ipv4 \
|
||||||
static_ipv6 \
|
static_ipv6 \
|
||||||
dhcp_ipv4
|
dhcp_ipv4 \
|
||||||
|
state_query_home \
|
||||||
|
state_query_work \
|
||||||
|
state_print
|
||||||
|
|
||||||
noargs_body() {
|
noargs_body() {
|
||||||
atf_check -s exit:1 -e ignore ifquery -S/dev/null
|
atf_check -s exit:1 -e ignore ifquery -S/dev/null
|
||||||
|
@ -43,3 +46,20 @@ dhcp_ipv4_body() {
|
||||||
atf_check -s exit:0 -o match:"inet dhcp" \
|
atf_check -s exit:0 -o match:"inet dhcp" \
|
||||||
ifquery -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces eth0
|
ifquery -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces eth0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state_query_home_body() {
|
||||||
|
atf_check -s exit:0 -o match:"iface home" \
|
||||||
|
ifquery -S $FIXTURES/alias-home.ifstate -i $FIXTURES/alias-home-work.interfaces wlan0
|
||||||
|
}
|
||||||
|
|
||||||
|
state_query_work_body() {
|
||||||
|
atf_check -s exit:0 -o match:"iface work" \
|
||||||
|
ifquery -S $FIXTURES/alias-work.ifstate -i $FIXTURES/alias-home-work.interfaces wlan0
|
||||||
|
}
|
||||||
|
|
||||||
|
state_print_body() {
|
||||||
|
atf_check -s exit:0 -o match:"wlan0=home" \
|
||||||
|
ifquery -S $FIXTURES/alias-home.ifstate -i $FIXTURES/alias-home-work.interfaces -s
|
||||||
|
atf_check -s exit:0 -o match:"wlan0=work" \
|
||||||
|
ifquery -S $FIXTURES/alias-work.ifstate -i $FIXTURES/alias-home-work.interfaces -s
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue