From 49dd8942f2e12c495477ff108107b142aa6839d0 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Tue, 4 Aug 2020 12:06:39 -0600 Subject: [PATCH] tests: add inheritance tests we only need to test ifquery, as this is just a merge operation. --- tests/fixtures/inheritance.interfaces | 10 ++++++++++ tests/ifquery_test | 20 +++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/inheritance.interfaces diff --git a/tests/fixtures/inheritance.interfaces b/tests/fixtures/inheritance.interfaces new file mode 100644 index 0000000..8b5f487 --- /dev/null +++ b/tests/fixtures/inheritance.interfaces @@ -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 diff --git a/tests/ifquery_test b/tests/ifquery_test index 2a9426d..68fa518 100755 --- a/tests/ifquery_test +++ b/tests/ifquery_test @@ -15,7 +15,9 @@ tests_init \ state_print \ learned_dependency \ learned_dependency_2 \ - learned_executor + learned_executor \ + inheritance_0 \ + inheritance_1 noargs_body() { 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" \ 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 +}