From 2fecbfc7e9b34488ea7aa322803ea4ab15cd5db7 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Wed, 29 Jul 2020 02:37:14 -0600 Subject: [PATCH] tests: add tests for learned executors --- tests/ifdown_test | 11 ++++++++++- tests/ifquery_test | 8 +++++++- tests/ifup_test | 9 ++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/ifdown_test b/tests/ifdown_test index 6fbad68..2d06865 100755 --- a/tests/ifdown_test +++ b/tests/ifdown_test @@ -16,7 +16,8 @@ tests_init \ alias_eth0_work \ bonded_bridge \ learned_dependency \ - learned_dependency_2 + learned_dependency_2 \ + learned_executor noargs_body() { atf_check -s exit:1 -e ignore ifdown -S/dev/null @@ -123,3 +124,11 @@ learned_dependency_2_body() { -E $EXECUTORS \ -i $FIXTURES/mock-dependency-generator-2.interfaces br0 } + +learned_executor_body() { + atf_check -s exit:0 -o ignore \ + -e match:"attempting to run mock executor" \ + ifdown -n -S $FIXTURES/mock-dependency-generator-2.ifstate \ + -E $EXECUTORS \ + -i $FIXTURES/mock-dependency-generator-2.interfaces br0 +} diff --git a/tests/ifquery_test b/tests/ifquery_test index 0fa5819..2a9426d 100755 --- a/tests/ifquery_test +++ b/tests/ifquery_test @@ -14,7 +14,8 @@ tests_init \ state_query_work \ state_print \ learned_dependency \ - learned_dependency_2 + learned_dependency_2 \ + learned_executor noargs_body() { atf_check -s exit:1 -e ignore ifquery -S/dev/null @@ -81,3 +82,8 @@ learned_dependency_2_body() { atf_check -s exit:0 -o match:"requires bond0" \ ifquery -E $EXECUTORS -i $FIXTURES/mock-dependency-generator-2.interfaces br0 } + +learned_executor_body() { + atf_check -s exit:0 -o match:"use mock" \ + ifquery -E $EXECUTORS -i $FIXTURES/mock-dependency-generator-2.interfaces br0 +} diff --git a/tests/ifup_test b/tests/ifup_test index 18c4902..311be66 100755 --- a/tests/ifup_test +++ b/tests/ifup_test @@ -16,7 +16,8 @@ tests_init \ alias_eth0_work \ bonded_bridge \ learned_dependency \ - learned_dependency_2 + learned_dependency_2 \ + learned_executor noargs_body() { atf_check -s exit:1 -e ignore ifup -S/dev/null @@ -116,3 +117,9 @@ learned_dependency_2_body() { -e match:"eth1" \ ifup -n -S/dev/null -E $EXECUTORS -i $FIXTURES/mock-dependency-generator-2.interfaces br0 } + +learned_executor_body() { + atf_check -s exit:0 -o ignore \ + -e match:"attempting to run mock executor" \ + ifup -n -S/dev/null -E $EXECUTORS -i $FIXTURES/mock-dependency-generator-2.interfaces br0 +}