From 9985995a9dd2423b496f25832ead2a42c798ee3f Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Mon, 19 Nov 2012 10:30:30 -0500 Subject: [PATCH] Make tests use the local connection type, fix missing callback in tests. --- test/TestPlayBook.py | 3 +++ test/TestRunner.py | 1 + test/alias_playbook.yml | 2 ++ test/hosts_list.yml | 1 + test/lookup_plugins.yml | 1 + test/playbook-included.yml | 2 ++ test/playbook1.yml | 1 + test/results_list.yml | 1 + 8 files changed, 12 insertions(+) diff --git a/test/TestPlayBook.py b/test/TestPlayBook.py index d67779b6731..f278932af04 100644 --- a/test/TestPlayBook.py +++ b/test/TestPlayBook.py @@ -22,6 +22,9 @@ class TestCallbacks(object): def set_playbook(self, playbook): self.playbook = playbook + def on_no_hosts_remaining(self): + pass + def on_start(self): EVENTS.append('start') diff --git a/test/TestRunner.py b/test/TestRunner.py index 895b2164c4d..3b2c9402607 100644 --- a/test/TestRunner.py +++ b/test/TestRunner.py @@ -35,6 +35,7 @@ class TestRunner(unittest.TestCase): forks=1, background=0, pattern='all', + transport='local', ) self.cwd = os.getcwd() self.test_dir = os.path.join(self.cwd, 'test') diff --git a/test/alias_playbook.yml b/test/alias_playbook.yml index 889862c11e3..3dec28dd798 100644 --- a/test/alias_playbook.yml +++ b/test/alias_playbook.yml @@ -1,5 +1,6 @@ --- - hosts: aliasgroup + connection: local vars: test_file: /tmp/ansible-alias-test tasks: @@ -9,6 +10,7 @@ - action: command removes=$test_file rm -f $test_file - hosts: all + connection: local gather_facts: False tasks: - action: command true diff --git a/test/hosts_list.yml b/test/hosts_list.yml index 458cee7a92a..09c5ca7c170 100644 --- a/test/hosts_list.yml +++ b/test/hosts_list.yml @@ -1,5 +1,6 @@ # Test that playbooks support YAML lists of hosts. --- - hosts: [host1, host2, host3] + connection: local tasks: - action: command true diff --git a/test/lookup_plugins.yml b/test/lookup_plugins.yml index e934fac145a..faf4d84816c 100644 --- a/test/lookup_plugins.yml +++ b/test/lookup_plugins.yml @@ -1,6 +1,7 @@ # simple test of lookup plugins in with_* --- - hosts: all + connection: local vars: empty_list: [] tasks: diff --git a/test/playbook-included.yml b/test/playbook-included.yml index d6cb3530a1c..c56cc1be7d7 100644 --- a/test/playbook-included.yml +++ b/test/playbook-included.yml @@ -1,10 +1,12 @@ --- - hosts: all + connection: local gather_facts: False tasks: - action: debug msg="$variable" - hosts: all + connection: local vars: - ugly: var gather_facts: False diff --git a/test/playbook1.yml b/test/playbook1.yml index bbadc7ec0f9..677e6d32db3 100644 --- a/test/playbook1.yml +++ b/test/playbook1.yml @@ -1,6 +1,7 @@ # extremely simple test of the most basic of playbook engine/functions --- - hosts: all + connection: local # the 'weasels' string should show up in the output diff --git a/test/results_list.yml b/test/results_list.yml index c44e22ba408..3c831deb353 100644 --- a/test/results_list.yml +++ b/test/results_list.yml @@ -1,6 +1,7 @@ --- # Test iterating over lines of stdout stored in a register. - hosts: localhost + connection: local vars: small_file: /etc/resolv.conf temp_file: /tmp/ansible_result_list.tmp