1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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.
This commit is contained in:
Michael DeHaan 2012-05-09 23:21:44 -04:00
parent f8807da57b
commit d4f660edc3
5 changed files with 0 additions and 196 deletions

View file

@ -172,28 +172,3 @@ class TestPlaybook(unittest.TestCase):
print data print data
assert data.find("ears") != -1, "template success" 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]

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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