summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/yaml_parsing
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2020-08-04 20:24:52 +0200
committerGitHub <noreply@github.com>2020-08-04 20:24:52 +0200
commit4e27569347afc72da453cd8ea430da99651d067a (patch)
treedc11e0653eec517c522f1d47a2252c4e975de6f4 /test/integration/targets/yaml_parsing
parentIntentional coverage, incidental_azure_rm_resource (#71052) (diff)
downloadansible-4e27569347afc72da453cd8ea430da99651d067a.tar.xz
ansible-4e27569347afc72da453cd8ea430da99651d067a.zip
Add more include and yaml parsing tests (#70506)
These additional tests should provide coverage for features currently tested by the postgres incidental tests.
Diffstat (limited to 'test/integration/targets/yaml_parsing')
-rw-r--r--test/integration/targets/yaml_parsing/aliases1
-rw-r--r--test/integration/targets/yaml_parsing/playbook.yml5
-rw-r--r--test/integration/targets/yaml_parsing/tasks/main.yml33
-rw-r--r--test/integration/targets/yaml_parsing/vars/main.yml1
4 files changed, 40 insertions, 0 deletions
diff --git a/test/integration/targets/yaml_parsing/aliases b/test/integration/targets/yaml_parsing/aliases
new file mode 100644
index 0000000000..b59832142f
--- /dev/null
+++ b/test/integration/targets/yaml_parsing/aliases
@@ -0,0 +1 @@
+shippable/posix/group3
diff --git a/test/integration/targets/yaml_parsing/playbook.yml b/test/integration/targets/yaml_parsing/playbook.yml
new file mode 100644
index 0000000000..b3c9d5b36e
--- /dev/null
+++ b/test/integration/targets/yaml_parsing/playbook.yml
@@ -0,0 +1,5 @@
+- hosts: localhost
+ gather_facts: false
+ vars:
+ foo: bar
+ foo: baz # yamllint disable rule:key-duplicates
diff --git a/test/integration/targets/yaml_parsing/tasks/main.yml b/test/integration/targets/yaml_parsing/tasks/main.yml
new file mode 100644
index 0000000000..9446e0d906
--- /dev/null
+++ b/test/integration/targets/yaml_parsing/tasks/main.yml
@@ -0,0 +1,33 @@
+- name: Test ANSIBLE_DUPLICATE_YAML_DICT_KEY=warn
+ command: ansible-playbook {{ verbosity }} {{ role_path }}/playbook.yml
+ environment:
+ ANSIBLE_DUPLICATE_YAML_DICT_KEY: warn
+ register: duplicate_warn
+
+- assert:
+ that:
+ - '"found a duplicate dict key (foo)" in duplicate_warn.stderr'
+ - duplicate_warn.rc == 0
+
+- name: Test ANSIBLE_DUPLICATE_YAML_DICT_KEY=error
+ command: ansible-playbook {{ verbosity }} {{ role_path }}/playbook.yml
+ failed_when: duplicate_error.rc != 4
+ environment:
+ ANSIBLE_DUPLICATE_YAML_DICT_KEY: error
+ register: duplicate_error
+
+- assert:
+ that:
+ - '"found a duplicate dict key (foo)" in duplicate_error.stderr'
+ - duplicate_error.rc == 4
+
+- name: Test ANSIBLE_DUPLICATE_YAML_DICT_KEY=ignore
+ command: ansible-playbook {{ verbosity }} {{ role_path }}/playbook.yml
+ environment:
+ ANSIBLE_DUPLICATE_YAML_DICT_KEY: ignore
+ register: duplicate_ignore
+
+- assert:
+ that:
+ - '"found a duplicate dict key (foo)" not in duplicate_ignore.stderr'
+ - duplicate_ignore.rc == 0
diff --git a/test/integration/targets/yaml_parsing/vars/main.yml b/test/integration/targets/yaml_parsing/vars/main.yml
new file mode 100644
index 0000000000..ea65e0b592
--- /dev/null
+++ b/test/integration/targets/yaml_parsing/vars/main.yml
@@ -0,0 +1 @@
+verbosity: "{{ '' if not ansible_verbosity else '-' ~ ('v' * ansible_verbosity) }}"