From d4f660edc375c15596d73972bffb82fb84662a8b Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 9 May 2012 23:21:44 -0400 Subject: [PATCH] Do not run unit tests against the EVENTS code because it is subject to change and that does not mean anything is broken. If we want to test playbooks, it's best to test the result of a playbook to make sure it does the correct thing. Also remove playbook2/3 yml which were not used. --- test/TestPlayBook.py | 25 -------------- test/playbook2.yml | 71 -------------------------------------- test/playbook3.yml | 71 -------------------------------------- test/playbook_included.yml | 14 -------- test/playbook_includes.yml | 15 -------- 5 files changed, 196 deletions(-) delete mode 100644 test/playbook2.yml delete mode 100644 test/playbook3.yml delete mode 100644 test/playbook_included.yml delete mode 100644 test/playbook_includes.yml diff --git a/test/TestPlayBook.py b/test/TestPlayBook.py index 72670ee4c30..c8c2eea4105 100644 --- a/test/TestPlayBook.py +++ b/test/TestPlayBook.py @@ -172,28 +172,3 @@ class TestPlaybook(unittest.TestCase): print data assert data.find("ears") != -1, "template success" - def test_includes(self): - pb = os.path.join(self.test_dir, 'playbook_includes.yml') - actual = self._run(pb) - - for i, event in enumerate(EVENTS): - print "EVENT %s"%(i) - print event - - if i == 6: - assert 'blue' in event[1][1]['cmd'] - - if i == 8: - assert 'quack' in event[1][1]['cmd'] - - if i == 10: - assert 'RAN' in event[1][1]['cmd'] - - if i == 12: - assert 'RAN' in event[1][1]['cmd'] - - if i == 14: - assert 'red' in event[1][1]['cmd'] - - if i == 18 or i == 20: - assert 'skipped' in event[0] diff --git a/test/playbook2.yml b/test/playbook2.yml deleted file mode 100644 index 66acae50f75..00000000000 --- a/test/playbook2.yml +++ /dev/null @@ -1,71 +0,0 @@ ---- -# this is an annotated example of some features available in playbooks -# it shows how to make sure packages are updated, how to make sure -# services are running, and how to template files. It also demos -# change handlers that can restart things (or trigger other actions) -# when resources change. For more advanced examples, see example2.yml - -# on all hosts, run as the user root... - -- hosts: all - user: root - - # make these variables available inside of templates - # for when we use the 'template' action/module later on... - - vars: - http_port: 80 - max_clients: 200 - - # define the tasks that are part of this play... - - tasks: - - # task #1 is to run an arbitrary command - # we'll simulate a long running task, wait for up to 45 seconds, poll every 5 - # obviously this does nothing useful but you get the idea - - - name: longrunner - action: command /bin/sleep 15 - async: 45 - poll: 5 - - # let's demo file operations. - # - # We can 'copy' files or 'template' them instead, using jinja2 - # as the templating engine. This is done using the variables - # from the vars section above mixed in with variables bubbled up - # automatically from tools like facter and ohai. 'copy' - # works just like 'template' but does not do variable subsitution. - # - # If and only if the file changes, restart apache at the very - # end of the playbook run - - - name: write some_random_foo configuration - action: template src=templates/foo.j2 dest=/etc/some_random_foo.conf - notify: - - restart apache - - # make sure httpd is installed at the latest version - - - name: install httpd - action: yum pkg=httpd state=latest - - # make sure httpd is running - - - name: httpd start - action: service name=httpd state=running - - # handlers are only run when things change, at the very end of each - # play. Let's define some. The names are significant and must - # match the 'notify' sections above - - handlers: - - # this particular handler is run when some_random_foo.conf - # is changed, and only then - - - name: restart apache - action: service name=httpd state=restarted - - diff --git a/test/playbook3.yml b/test/playbook3.yml deleted file mode 100644 index 66acae50f75..00000000000 --- a/test/playbook3.yml +++ /dev/null @@ -1,71 +0,0 @@ ---- -# this is an annotated example of some features available in playbooks -# it shows how to make sure packages are updated, how to make sure -# services are running, and how to template files. It also demos -# change handlers that can restart things (or trigger other actions) -# when resources change. For more advanced examples, see example2.yml - -# on all hosts, run as the user root... - -- hosts: all - user: root - - # make these variables available inside of templates - # for when we use the 'template' action/module later on... - - vars: - http_port: 80 - max_clients: 200 - - # define the tasks that are part of this play... - - tasks: - - # task #1 is to run an arbitrary command - # we'll simulate a long running task, wait for up to 45 seconds, poll every 5 - # obviously this does nothing useful but you get the idea - - - name: longrunner - action: command /bin/sleep 15 - async: 45 - poll: 5 - - # let's demo file operations. - # - # We can 'copy' files or 'template' them instead, using jinja2 - # as the templating engine. This is done using the variables - # from the vars section above mixed in with variables bubbled up - # automatically from tools like facter and ohai. 'copy' - # works just like 'template' but does not do variable subsitution. - # - # If and only if the file changes, restart apache at the very - # end of the playbook run - - - name: write some_random_foo configuration - action: template src=templates/foo.j2 dest=/etc/some_random_foo.conf - notify: - - restart apache - - # make sure httpd is installed at the latest version - - - name: install httpd - action: yum pkg=httpd state=latest - - # make sure httpd is running - - - name: httpd start - action: service name=httpd state=running - - # handlers are only run when things change, at the very end of each - # play. Let's define some. The names are significant and must - # match the 'notify' sections above - - handlers: - - # this particular handler is run when some_random_foo.conf - # is changed, and only then - - - name: restart apache - action: service name=httpd state=restarted - - diff --git a/test/playbook_included.yml b/test/playbook_included.yml deleted file mode 100644 index 6fb41de47eb..00000000000 --- a/test/playbook_included.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- name: test vars - action: shell echo $favcolor - -- name: test vars_files - action: shell echo $duck - -- name: test vars condition - action: shell echo RAN - only_if: $guard - -- name: test vars_files condition - action: shell echo RAN - only_if: $extguard diff --git a/test/playbook_includes.yml b/test/playbook_includes.yml deleted file mode 100644 index b1dd36c69ab..00000000000 --- a/test/playbook_includes.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# Test correct variable expansion in included files and only if -- hosts: all - vars: - favcolor: "blue" - guard: ' "$favcolor" == "blue" ' - vars_files: - - common_vars.yml - - tasks: - - - include: playbook_included.yml - - # test overrides of variables - - include: playbook_included.yml favcolor=red