tests: add inheritance tests

we only need to test ifquery, as this is just a merge
operation.
This commit is contained in:
Ariadne Conill 2020-08-04 12:06:39 -06:00
parent 8615cf62ef
commit 49dd8942f2
2 changed files with 29 additions and 1 deletions

10
tests/fixtures/inheritance.interfaces vendored Normal file
View file

@ -0,0 +1,10 @@
iface base0
address 203.0.113.2/24
address 2001:db8:1000:2::2/64
iface inherit0 inherits base0
address 203.0.113.3/24
iface inherit1
inherit base0
address 203.0.113.4/24

View file

@ -15,7 +15,9 @@ tests_init \
state_print \ state_print \
learned_dependency \ learned_dependency \
learned_dependency_2 \ learned_dependency_2 \
learned_executor learned_executor \
inheritance_0 \
inheritance_1
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
@ -87,3 +89,19 @@ learned_executor_body() {
atf_check -s exit:0 -o match:"use mock" \ atf_check -s exit:0 -o match:"use mock" \
ifquery -E $EXECUTORS -i $FIXTURES/mock-dependency-generator-2.interfaces br0 ifquery -E $EXECUTORS -i $FIXTURES/mock-dependency-generator-2.interfaces br0
} }
inheritance_0_body() {
atf_check -s exit:0 -o match:"inherit base0" \
-o match:"address 203.0.113.2/24" \
-o match:"address 203.0.113.3/24" \
-o match:"address 2001:db8:1000:2::2/64" \
ifquery -E $EXECUTORS -i $FIXTURES/inheritance.interfaces inherit0
}
inheritance_1_body() {
atf_check -s exit:0 -o match:"inherit base0" \
-o match:"address 203.0.113.2/24" \
-o match:"address 203.0.113.4/24" \
-o match:"address 2001:db8:1000:2::2/64" \
ifquery -E $EXECUTORS -i $FIXTURES/inheritance.interfaces inherit1
}