ifupdown-ng/tests/ifquery_test

45 lines
1.1 KiB
Text
Raw Normal View History

#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/test_env.sh
tests_init \
2020-07-19 06:17:42 +00:00
noargs \
2020-07-19 10:50:30 +00:00
loopback_always_configured \
static_dual_stack \
static_ipv4 \
static_ipv6 \
dhcp_ipv4
noargs_body() {
atf_check -s exit:1 -e ignore ifquery
}
2020-07-19 06:17:42 +00:00
loopback_always_configured_body() {
atf_check -s exit:0 -o match:"inet loopback" ifquery --pretty-print lo
}
2020-07-19 10:50:30 +00:00
static_dual_stack_body() {
atf_check -s exit:0 -o match:"address 203.0.113.2/24" \
-o match:"address 2001:db8:1000:2::2/64" \
-o match:"gateway 203.0.113.1" \
-o match:"gateway 2001:db8:1000:2::1" \
ifquery -i $FIXTURES/static-eth0.interfaces eth0
}
static_ipv4_body() {
atf_check -s exit:0 -o match:"address 203.0.113.2/24" \
-o match:"gateway 203.0.113.1" \
ifquery -i $FIXTURES/static-eth0-v4.interfaces eth0
}
static_ipv6_body() {
atf_check -s exit:0 -o match:"address 2001:db8:1000:2::2/64" \
-o match:"gateway 2001:db8:1000:2::1" \
ifquery -i $FIXTURES/static-eth0-v6.interfaces eth0
}
dhcp_ipv4_body() {
atf_check -s exit:0 -o match:"inet dhcp" \
ifquery -i $FIXTURES/dhcp-eth0.interfaces eth0
}