mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Remove out of date tests.
This commit is contained in:
parent
a45494a896
commit
800f12618e
4 changed files with 3 additions and 129 deletions
|
@ -164,76 +164,6 @@ class TestPlaybook(unittest.TestCase):
|
||||||
data = file('/tmp/ansible_test_data_template.out').read()
|
data = file('/tmp/ansible_test_data_template.out').read()
|
||||||
assert data.find("ears") != -1, "template success"
|
assert data.find("ears") != -1, "template success"
|
||||||
|
|
||||||
# disabling until we have a nice way of using lookup plugins inside '{{' and '}}'
|
|
||||||
|
|
||||||
#def test_lookups(self):
|
|
||||||
# pb = os.path.join(self.test_dir, 'lookup_plugins.yml')
|
|
||||||
# actual = self._run(pb)
|
|
||||||
#
|
|
||||||
# # if different, this will output to screen
|
|
||||||
# print "**ACTUAL**"
|
|
||||||
# print utils.jsonify(actual, format=True)
|
|
||||||
# expected = {
|
|
||||||
# "localhost": {
|
|
||||||
# "changed": 16,
|
|
||||||
# "failures": 0,
|
|
||||||
# "ok": 21,
|
|
||||||
# "skipped": 1,
|
|
||||||
# "unreachable": 0
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# print "**EXPECTED**"
|
|
||||||
# print utils.jsonify(expected, format=True)
|
|
||||||
#
|
|
||||||
# assert utils.jsonify(expected, format=True) == utils.jsonify(actual,format=True)
|
|
||||||
#
|
|
||||||
# print "len(EVENTS) = %d" % len(EVENTS)
|
|
||||||
# assert len(EVENTS) == 74
|
|
||||||
|
|
||||||
def test_includes(self):
|
|
||||||
pb = os.path.join(self.test_dir, 'playbook-includer.yml')
|
|
||||||
actual = self._run(pb)
|
|
||||||
|
|
||||||
# if different, this will output to screen
|
|
||||||
print "**ACTUAL**"
|
|
||||||
print utils.jsonify(actual, format=True)
|
|
||||||
expected = {
|
|
||||||
"localhost": {
|
|
||||||
"changed": 0,
|
|
||||||
"failures": 0,
|
|
||||||
"ok": 6,
|
|
||||||
"skipped": 0,
|
|
||||||
"unreachable": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print "**EXPECTED**"
|
|
||||||
print utils.jsonify(expected, format=True)
|
|
||||||
|
|
||||||
assert utils.jsonify(expected, format=True) == utils.jsonify(actual,format=True)
|
|
||||||
|
|
||||||
def test_templated_includes(self):
|
|
||||||
pb = os.path.join(self.test_dir, 'playbook-templated-includer.yml')
|
|
||||||
actual = self._run(pb, extra_vars={ 'dir': self.test_dir })
|
|
||||||
|
|
||||||
# if different, this will output to screen
|
|
||||||
print "**ACTUAL**"
|
|
||||||
actual_json = utils.jsonify(actual, format=True)
|
|
||||||
print actual_json
|
|
||||||
expected = {
|
|
||||||
"localhost": {
|
|
||||||
"changed": 0,
|
|
||||||
"failures": 0,
|
|
||||||
"ok": 2,
|
|
||||||
"skipped": 0,
|
|
||||||
"unreachable": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
expected_json = utils.jsonify(expected, format=True)
|
|
||||||
print "**EXPECTED**"
|
|
||||||
print expected_json
|
|
||||||
|
|
||||||
assert actual_json == expected_json
|
|
||||||
|
|
||||||
def test_task_includes(self):
|
def test_task_includes(self):
|
||||||
pb = os.path.join(self.test_dir, 'task-includer.yml')
|
pb = os.path.join(self.test_dir, 'task-includer.yml')
|
||||||
actual = self._run(pb)
|
actual = self._run(pb)
|
||||||
|
@ -326,35 +256,6 @@ class TestPlaybook(unittest.TestCase):
|
||||||
play = ansible.playbook.Play(playbook, playbook.playbook[0], os.getcwd())
|
play = ansible.playbook.Play(playbook, playbook.playbook[0], os.getcwd())
|
||||||
assert play.hosts == ';'.join(('host1', 'host2', 'host3'))
|
assert play.hosts == ';'.join(('host1', 'host2', 'host3'))
|
||||||
|
|
||||||
def test_playbook_when(self):
|
|
||||||
test_callbacks = TestCallbacks()
|
|
||||||
playbook = ansible.playbook.PlayBook(
|
|
||||||
playbook=os.path.join(self.test_dir, 'playbook-when.yml'),
|
|
||||||
host_list='test/ansible_hosts',
|
|
||||||
extra_vars={ 'external' : 'xyz', 'identity': 'identity' },
|
|
||||||
stats=ans_callbacks.AggregateStats(),
|
|
||||||
callbacks=test_callbacks,
|
|
||||||
runner_callbacks=test_callbacks
|
|
||||||
)
|
|
||||||
actual = playbook.run()
|
|
||||||
|
|
||||||
# if different, this will output to screen
|
|
||||||
print "**ACTUAL**"
|
|
||||||
print utils.jsonify(actual, format=True)
|
|
||||||
expected = {
|
|
||||||
"localhost": {
|
|
||||||
"changed": 0,
|
|
||||||
"failures": 0,
|
|
||||||
"ok": 3,
|
|
||||||
"skipped": 3,
|
|
||||||
"unreachable": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print "**EXPECTED**"
|
|
||||||
print utils.jsonify(expected, format=True)
|
|
||||||
|
|
||||||
assert utils.jsonify(expected, format=True) == utils.jsonify(actual,format=True)
|
|
||||||
|
|
||||||
def test_playbook_hash_replace(self):
|
def test_playbook_hash_replace(self):
|
||||||
# save default hash behavior so we can restore it in the end of the test
|
# save default hash behavior so we can restore it in the end of the test
|
||||||
saved_hash_behavior = C.DEFAULT_HASH_BEHAVIOUR
|
saved_hash_behavior = C.DEFAULT_HASH_BEHAVIOUR
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
connection: local
|
connection: local
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
tasks:
|
tasks:
|
||||||
- action: debug msg="$variable"
|
- action: debug msg="{{ variable }}"
|
||||||
|
|
||||||
- hosts: all
|
- hosts: all
|
||||||
connection: local
|
connection: local
|
||||||
|
@ -11,4 +11,4 @@
|
||||||
- ugly: var
|
- ugly: var
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
tasks:
|
tasks:
|
||||||
- action: debug msg="$variable"
|
- action: debug msg="{{ variable }}"
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
---
|
|
||||||
- hosts: all
|
|
||||||
connection: local
|
|
||||||
gather_facts: False
|
|
||||||
|
|
||||||
vars:
|
|
||||||
internal: "print me"
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- action: debug msg="skip me"
|
|
||||||
when_unset: $internal
|
|
||||||
|
|
||||||
- action: debug msg="$internal"
|
|
||||||
when_set: $internal
|
|
||||||
|
|
||||||
- action: debug msg="skip me"
|
|
||||||
when_unset: $external
|
|
||||||
|
|
||||||
- action: debug msg="$external"
|
|
||||||
when_set: $external
|
|
||||||
|
|
||||||
- action: debug msg="run me"
|
|
||||||
when_unset: $this_var_does_not_exist
|
|
||||||
|
|
||||||
- action: debug msg="skip me"
|
|
||||||
when_set: $this_var_does_not_exist
|
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
|
|
||||||
- name: this should be skipped
|
- name: this should be skipped
|
||||||
action: shell echo 'if you see this, this is wrong ($facter_operatingsystem)'
|
action: shell echo 'if you see this, this is wrong ($facter_operatingsystem)'
|
||||||
only_if: "'$facter_operatingsystem' == 'Imaginary'"
|
when: 2 == 3
|
||||||
|
|
||||||
handlers:
|
handlers:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue