You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/templating/tasks/plugin_errors.yml

73 lines
2.0 KiB
YAML

- name: attempt to use a filter plugin that fails to load
raw: echo {{ '' | broken }}
ignore_errors: yes
register: error
- assert:
that:
- error is failed
- |
error.msg is contains("filter plugin 'broken' failed to load: boom")
- name: attempt to use a filter plugin that is not found
raw: echo {{ '' | nope }}
ignore_errors: yes
register: error
- assert:
that:
- error is failed
- error.msg is contains("No filter named 'nope'")
- name: attempt to use a test plugin that fails to load
raw: echo {{ '' is broken }}
ignore_errors: yes
register: error
- assert:
that:
- error is failed
- |
error.msg is contains("test plugin 'broken' failed to load: boom")
- name: attempt to use a test plugin that is not found
raw: echo {{ '' is nope }}
ignore_errors: yes
register: error
- assert:
that:
- error is failed
- error.msg is contains("No test named 'nope'")
- name: attempt to use a lookup plugin that fails to load
raw: echo {{ lookup('broken') }}
ignore_errors: yes
register: error
- assert:
that:
- error is failed
- |
error.msg is contains("lookup plugin 'broken' failed to load: boom")
- name: attempt to use a lookup plugin that is not found
raw: echo {{ lookup('nope') }}
ignore_errors: yes
register: error
- assert:
that:
- error is failed
- error.msg is contains("lookup plugin 'nope' was not found")
- name: verify plugin errors are captured
assert:
that:
- (syntax_error | ansible._protomatter.dump_object).exception.message is contains "Syntax error in template"
- (undef(0) | ansible._protomatter.dump_object).exception.message is contains "argument must be of type"
- (lookup('pipe', 'exit 1') | ansible._protomatter.dump_object).exception.message is contains "lookup plugin 'pipe' failed"
- ('{' | from_json | ansible._protomatter.dump_object).exception.message is contains "Expecting property name enclosed in double quotes"
vars:
syntax_error: "{{ #'"