summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2020-03-23 20:47:58 +0100
committerGitHub <noreply@github.com>2020-03-23 20:47:58 +0100
commitee6413af471adb46ba6011662e17e52c1655c26c (patch)
treea9a736f8cfcf52a314d5ab38d5a4e5d2025cfea9 /test/integration
parentUpdate 2.10 roadmap (#68081) (diff)
downloadansible-ee6413af471adb46ba6011662e17e52c1655c26c.tar.xz
ansible-ee6413af471adb46ba6011662e17e52c1655c26c.zip
Address fixme and handle filter/test errors for collections better (#68047)
* Address fixme and handle fitler/test errors for collections better. Fixes #66721 * Re-arrange code
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/targets/collections/collection_root_user/ansible_collections/testns/testbroken/plugins/filter/broken_filter.py13
-rw-r--r--test/integration/targets/collections/posix.yml19
2 files changed, 32 insertions, 0 deletions
diff --git a/test/integration/targets/collections/collection_root_user/ansible_collections/testns/testbroken/plugins/filter/broken_filter.py b/test/integration/targets/collections/collection_root_user/ansible_collections/testns/testbroken/plugins/filter/broken_filter.py
new file mode 100644
index 0000000000..64c25dc216
--- /dev/null
+++ b/test/integration/targets/collections/collection_root_user/ansible_collections/testns/testbroken/plugins/filter/broken_filter.py
@@ -0,0 +1,13 @@
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+
+class FilterModule(object):
+
+ def filters(self):
+ return {
+ 'broken': lambda x: 'broken',
+ }
+
+
+raise Exception('This is a broken filter plugin')
diff --git a/test/integration/targets/collections/posix.yml b/test/integration/targets/collections/posix.yml
index 63937dc5c3..89e2a654bf 100644
--- a/test/integration/targets/collections/posix.yml
+++ b/test/integration/targets/collections/posix.yml
@@ -95,6 +95,25 @@
- lookup('testns.testcoll.mylookup2') == 'mylookup2_from_user_dir'
- lookup('testns.testcoll.lookup_subdir.my_subdir_lookup') == 'subdir_lookup_from_user_dir'
+ - debug:
+ msg: "{{ 'foo'|testns.testbroken.broken }}"
+ register: result
+ ignore_errors: true
+
+ - assert:
+ that:
+ - |
+ 'This is a broken filter plugin.' in result.msg
+
+ - debug:
+ msg: "{{ 'foo'|missing.collection.filter }}"
+ register: result
+ ignore_errors: true
+
+ - assert:
+ that:
+ - result is failed
+
# ensure that the synthetic ansible.builtin collection limits to builtin plugins, that ansible.legacy loads overrides
# from legacy plugin dirs, and that a same-named plugin loaded from a real collection is not masked by the others
- hosts: testhost