2019-01-26 04:37:56 +01:00
- hosts : testhost
2017-01-27 20:53:02 +01:00
gather_facts : no
tasks :
- name : Use a specially crafted module to see if things were imported correctly
test :
register : result
- name : Check that the module imported the correct version of each module_util
assert :
that :
- 'result["abcdefgh"] == "abcdefgh"'
- 'result["bar0"] == "bar0"'
- 'result["bar1"] == "bar1"'
- 'result["bar2"] == "bar2"'
- 'result["baz1"] == "baz1"'
- 'result["baz2"] == "baz2"'
- 'result["foo0"] == "foo0"'
- 'result["foo1"] == "foo1"'
- 'result["foo2"] == "foo2"'
- 'result["qux1"] == "qux1"'
- 'result["qux2"] == ["qux2:quux", "qux2:quuz"]'
- 'result["spam1"] == "spam1"'
- 'result["spam2"] == "spam2"'
- 'result["spam3"] == "spam3"'
- 'result["spam4"] == "spam4"'
- 'result["spam5"] == ["spam5:bacon", "spam5:eggs"]'
- 'result["spam6"] == ["spam6:bacon", "spam6:eggs"]'
- 'result["spam7"] == ["spam7:bacon", "spam7:eggs"]'
- 'result["spam8"] == ["spam8:bacon", "spam8:eggs"]'
# Test that overriding something in module_utils with something in the local library works
- name : Test that local module_utils overrides facts.py
test_override :
register : result
- name : Make sure the we used the local facts.py, not the one shipped with ansible
assert :
that :
2017-04-21 22:17:12 +02:00
- result["data"] == "overridden facts.py"
2017-01-27 20:53:02 +01:00
- name : Test that importing a module that only exists inside of a submodule does not work
test_failure :
ignore_errors : True
register : result
2017-02-03 02:48:53 +01:00
- debug : var=result
2017-01-27 20:53:02 +01:00
- name : Make sure we failed in AnsiBallZ
assert :
that :
2017-11-27 23:58:08 +01:00
- result is failed
2020-07-17 19:57:44 +02:00
- result['msg'] == "Could not find imported module support code for ansible.modules.test_failure. Looked for (['ansible.module_utils.zebra.foo', 'ansible.module_utils.zebra'])"
2019-09-06 00:47:42 +02:00
- name : Test that alias deprecation works
test_alias_deprecation :
baz : 'bar'
register : result
- name : Assert that the deprecation message is given correctly
assert :
that :
- result.deprecations[0].msg == "Alias 'baz' is deprecated. See the module docs for more information"
- result.deprecations[0].version == '9.99'