mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-09-01 10:51:01 -07:00
* Do not remove non-ASCII Unicode from multi-line string output.
* Added basic tests.
* Add Unicode test.
* Simplify tests, avoid later Jinja features.
* Refactor.
* Make use diy tests use callback test framework as well.
* Remove color codes.
* Work around stable-2.9 bug.
* Simplify again.
(cherry picked from commit 0a7ed3b019
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
c0bb56c454
commit
5fa1fc65ca
9 changed files with 322 additions and 255 deletions
2
tests/integration/targets/callback_yaml/aliases
Normal file
2
tests/integration/targets/callback_yaml/aliases
Normal file
|
@ -0,0 +1,2 @@
|
|||
shippable/posix/group1
|
||||
needs/target/callback
|
60
tests/integration/targets/callback_yaml/tasks/main.yml
Normal file
60
tests/integration/targets/callback_yaml/tasks/main.yml
Normal file
|
@ -0,0 +1,60 @@
|
|||
---
|
||||
####################################################################
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
|
||||
- name: Run tests
|
||||
include_role:
|
||||
name: callback
|
||||
vars:
|
||||
tests:
|
||||
- name: Basic run
|
||||
environment:
|
||||
ANSIBLE_NOCOLOR: 'true'
|
||||
ANSIBLE_FORCE_COLOR: 'false'
|
||||
ANSIBLE_STDOUT_CALLBACK: community.general.yaml
|
||||
playbook: |
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Sample task name
|
||||
debug:
|
||||
msg: sample debug msg
|
||||
expected_output: [
|
||||
"",
|
||||
"PLAY [testhost] ****************************************************************",
|
||||
"",
|
||||
"TASK [Sample task name] ********************************************************",
|
||||
"ok: [testhost] => ",
|
||||
" msg: sample debug msg",
|
||||
"",
|
||||
"PLAY RECAP *********************************************************************",
|
||||
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
|
||||
]
|
||||
- name: Test umlauts in multiline
|
||||
environment:
|
||||
ANSIBLE_NOCOLOR: 'true'
|
||||
ANSIBLE_FORCE_COLOR: 'false'
|
||||
ANSIBLE_STDOUT_CALLBACK: community.general.yaml
|
||||
playbook: |
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Umlaut output
|
||||
debug:
|
||||
msg: "äöü\néêè\nßï☺"
|
||||
expected_output: [
|
||||
"",
|
||||
"PLAY [testhost] ****************************************************************",
|
||||
"",
|
||||
"TASK [Umlaut output] ***********************************************************",
|
||||
"ok: [testhost] => ",
|
||||
" msg: |-",
|
||||
" äöü",
|
||||
" éêè",
|
||||
" ßï☺",
|
||||
"",
|
||||
"PLAY RECAP *********************************************************************",
|
||||
"testhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 "
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue