1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

added tests for log_plays (#56811)

* added tests for log_plays

* grep for warning

* Update tests to work with ansible-test.
This commit is contained in:
Brian Coca 2019-05-24 12:24:31 -04:00 committed by GitHub
parent f76556e56d
commit 30210e7de0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1 @@
shippable/posix/group3

View file

@ -0,0 +1,4 @@
- hosts: localhost
gather_facts: false
tasks:
- ping:

View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -eux
export ANSIBLE_CALLBACK_WHITELIST="log_plays,${ANSIBLE_CALLBACK_WHITELIST:-}"
# run play, should create log and dir if needed
export ANSIBLE_LOG_FOLDER="logit"
ansible-playbook ping_log.yml -v "$@"
[[ -f "${ANSIBLE_LOG_FOLDER}/localhost" ]]
# now force it to fail
export ANSIBLE_LOG_FOLDER="logit.file"
touch "${ANSIBLE_LOG_FOLDER}"
ansible-playbook ping_log.yml -v "$@" 2>&1| grep 'Failure using method (v2_runner_on_ok) in callback plugin'
[[ ! -f "${ANSIBLE_LOG_FOLDER}/localhost" ]]