From 8669c687a75a00106b055add49b82fee826b8fe8 Mon Sep 17 00:00:00 2001 From: Dan Radez Date: Fri, 8 Sep 2017 12:40:05 -0400 Subject: Show ansible tasks as they complete Change-Id: I1b68d70fd97076a7f2ca68091a6e94d87b72efa2 Signed-off-by: Dan Radez --- apex/tests/playbooks/test_failed_playbook.yaml | 5 +++++ apex/tests/test_apex_common_utils.py | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 apex/tests/playbooks/test_failed_playbook.yaml (limited to 'apex/tests') diff --git a/apex/tests/playbooks/test_failed_playbook.yaml b/apex/tests/playbooks/test_failed_playbook.yaml new file mode 100644 index 00000000..d12cefb1 --- /dev/null +++ b/apex/tests/playbooks/test_failed_playbook.yaml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + tasks: + - fail: + msg: "Failure to test with" diff --git a/apex/tests/test_apex_common_utils.py b/apex/tests/test_apex_common_utils.py index 12aeaf2c..aee39a75 100644 --- a/apex/tests/test_apex_common_utils.py +++ b/apex/tests/test_apex_common_utils.py @@ -19,7 +19,8 @@ from apex.tests.constants import ( from nose.tools import ( assert_equal, assert_is_instance, - assert_not_is_instance) + assert_not_is_instance, + assert_raises) NET_SETS = os.path.join(TEST_CONFIG_DIR, 'network', 'network_settings.yaml') @@ -60,3 +61,8 @@ class TestCommonUtils: playbook = 'apex/tests/playbooks/test_playbook.yaml' assert_equal(utils.run_ansible(None, os.path.join(playbook), dry_run=True), None) + + def test_failed_run_ansible(self): + playbook = 'apex/tests/playbooks/test_failed_playbook.yaml' + assert_raises(Exception, utils.run_ansible, None, + os.path.join(playbook), dry_run=True) -- cgit 1.2.3-korg