summaryrefslogtreecommitdiff
path: root/test/integration/targets/no_log
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2016-10-12 14:57:53 -0700
committerGitHub <noreply@github.com>2016-10-12 14:57:53 -0700
commit80a5c70ad795f3cd1e6e3edde7077a8dfd65470b (patch)
tree50ab0ad670d2631fa32cad47019d9a970ed81596 /test/integration/targets/no_log
parentbf3d546d9a48cf5391a91002733d4a6ea62b1a0c (diff)
downloadansible-80a5c70ad795f3cd1e6e3edde7077a8dfd65470b.tar.gz
Split integration tests out from Makefile. (#17976)
Diffstat (limited to 'test/integration/targets/no_log')
-rw-r--r--test/integration/targets/no_log/no_log_local.yml66
-rwxr-xr-xtest/integration/targets/no_log/runme.sh9
2 files changed, 75 insertions, 0 deletions
diff --git a/test/integration/targets/no_log/no_log_local.yml b/test/integration/targets/no_log/no_log_local.yml
new file mode 100644
index 0000000000..87d76ff082
--- /dev/null
+++ b/test/integration/targets/no_log/no_log_local.yml
@@ -0,0 +1,66 @@
+# TODO: test against real connection plugins to ensure they're not leaking module args
+
+- name: normal play
+ hosts: testhost
+ gather_facts: no
+ tasks:
+ - name: args should be logged in the absence of no_log
+ shell: echo "LOG_ME_TASK_SUCCEEDED"
+
+ - name: failed args should be logged in the absence of no_log
+ shell: echo "LOG_ME_TASK_FAILED"
+ failed_when: true
+ ignore_errors: true
+
+ - name: item args should be logged in the absence of no_log
+ shell: echo {{ item }}
+ with_items: [ "LOG_ME_ITEM", "LOG_ME_SKIPPED", "LOG_ME_ITEM_FAILED" ]
+ when: item != "LOG_ME_SKIPPED"
+ failed_when: item == "LOG_ME_ITEM_FAILED"
+ ignore_errors: true
+
+ - name: args should not be logged when task-level no_log set
+ shell: echo "DO_NOT_LOG_TASK_SUCCEEDED"
+ no_log: true
+
+ - name: failed args should not be logged when task-level no_log set
+ shell: echo "DO_NOT_LOG_TASK_FAILED"
+ no_log: true
+ failed_when: true
+ ignore_errors: true
+
+ - name: skipped task args should be suppressed with no_log
+ shell: echo "DO_NOT_LOG_TASK_SKIPPED"
+ no_log: true
+ when: false
+
+ - name: items args should be suppressed with no_log in every state
+ shell: echo {{ item }}
+ no_log: true
+ with_items: [ "DO_NOT_LOG_ITEM", "DO_NOT_LOG_ITEM_SKIPPED", "DO_NOT_LOG_ITEM_FAILED" ]
+ when: item != "DO_NOT_LOG_ITEM_SKIPPED"
+ failed_when: item == "DO_NOT_LOG_ITEM_FAILED"
+ ignore_errors: yes
+
+ - name: async task args should suppressed with no_log
+ async: 10
+ poll: 1
+ shell: echo "DO_NOT_LOG_ASYNC_TASK_SUCCEEDED"
+ no_log: true
+
+- name: play-level no_log set
+ hosts: testhost
+ gather_facts: no
+ no_log: true
+ tasks:
+ - name: args should not be logged when play-level no_log set
+ shell: echo "DO_NOT_LOG_PLAY"
+
+ - name: args should not be logged when both play- and task-level no_log set
+ shell: echo "DO_NOT_LOG_TASK_AND_PLAY"
+ no_log: true
+
+ - name: args should be logged when task-level no_log overrides play-level
+ shell: echo "LOG_ME_OVERRIDE"
+ no_log: false
+
diff --git a/test/integration/targets/no_log/runme.sh b/test/integration/targets/no_log/runme.sh
new file mode 100755
index 0000000000..e20bb08c4f
--- /dev/null
+++ b/test/integration/targets/no_log/runme.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+set -eux
+
+# This test expects 7 loggable vars and 0 non-loggable ones.
+# If either mismatches it fails, run the ansible-playbook command to debug.
+
+[ "$(ansible-playbook no_log_local.yml -i ../../inventory -vvvvv "$@" | awk \
+'BEGIN { logme = 0; nolog = 0; } /LOG_ME/ { logme += 1;} /DO_NOT_LOG/ { nolog += 1;} END { printf "%d/%d", logme, nolog; }')" = "26/0" ]