diff options
author | Matt Clay <mclay@redhat.com> | 2020-02-11 01:41:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-11 01:41:45 +0100 |
commit | 89c8eb5a085552b544c4da9b1c1f272b645c64d9 (patch) | |
tree | b4b60c5c435e52aa1c83befec8f13886bea3b88c /test/integration/targets/path_lookups | |
parent | ansible-test - add constraint for virtualenv (#67289) (diff) | |
download | ansible-89c8eb5a085552b544c4da9b1c1f272b645c64d9.tar.xz ansible-89c8eb5a085552b544c4da9b1c1f272b645c64d9.zip |
Split up lookup integration tests. (#67294)
* Split up lookup integration tests.
* Rename lookup_paths integration test.
This will avoid confusing it for a test of the `paths` lookup plugin, which does not exist.
* Fix lookup_pipe integration test.
The test now verifies it receives the correct output.
Adding a second task also causes code coverage to be properly registered for the lookup plugin.
* Rename ini lookup test to match plugin name.
* Update sanity ignore path.
Diffstat (limited to 'test/integration/targets/path_lookups')
5 files changed, 77 insertions, 0 deletions
diff --git a/test/integration/targets/path_lookups/aliases b/test/integration/targets/path_lookups/aliases new file mode 100644 index 0000000000..b59832142f --- /dev/null +++ b/test/integration/targets/path_lookups/aliases @@ -0,0 +1 @@ +shippable/posix/group3 diff --git a/test/integration/targets/path_lookups/play.yml b/test/integration/targets/path_lookups/play.yml new file mode 100644 index 0000000000..7321589bf9 --- /dev/null +++ b/test/integration/targets/path_lookups/play.yml @@ -0,0 +1,49 @@ +- name: setup state + hosts: localhost + gather_facts: false + tasks: + - file: path={{playbook_dir}}/files state=directory + - file: path={{playbook_dir}}/roles/showfile/files state=directory + - copy: dest={{playbook_dir}}/roles/showfile/files/testfile content='in role files' + - copy: dest={{playbook_dir}}/roles/showfile/testfile content='in role' + - copy: dest={{playbook_dir}}/roles/showfile/tasks/testfile content='in role tasks' + - copy: dest={{playbook_dir}}/files/testfile content='in files' + - copy: dest={{playbook_dir}}/testfile content='in local' + +- include: testplay.yml + vars: + remove: nothing + role_out: in role files + play_out: in files + +- include: testplay.yml + vars: + remove: roles/showfile/files/testfile + role_out: in role + play_out: in files + +- include: testplay.yml + vars: + remove: roles/showfile/testfile + role_out: in role tasks + play_out: in files + +- include: testplay.yml + vars: + remove: roles/showfile/tasks/testfile + role_out: in files + play_out: in files + +- include: testplay.yml + vars: + remove: files/testfile + role_out: in local + play_out: in local + +- name: cleanup + hosts: localhost + gather_facts: false + tasks: + - file: path={{playbook_dir}}/testfile state=absent + - file: path={{playbook_dir}}/files state=absent + - file: path={{playbook_dir}}/roles/showfile/files state=absent diff --git a/test/integration/targets/path_lookups/roles/showfile/tasks/main.yml b/test/integration/targets/path_lookups/roles/showfile/tasks/main.yml new file mode 100644 index 0000000000..1b3805798d --- /dev/null +++ b/test/integration/targets/path_lookups/roles/showfile/tasks/main.yml @@ -0,0 +1,2 @@ +- name: relative to role + set_fact: role_result="{{lookup('file', 'testfile')}}" diff --git a/test/integration/targets/path_lookups/runme.sh b/test/integration/targets/path_lookups/runme.sh new file mode 100755 index 0000000000..754150b4c7 --- /dev/null +++ b/test/integration/targets/path_lookups/runme.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -eux + +ansible-playbook play.yml -i ../../inventory -v "$@" diff --git a/test/integration/targets/path_lookups/testplay.yml b/test/integration/targets/path_lookups/testplay.yml new file mode 100644 index 0000000000..8bf4553275 --- /dev/null +++ b/test/integration/targets/path_lookups/testplay.yml @@ -0,0 +1,20 @@ +- name: test initial state + hosts: localhost + gather_facts: false + pre_tasks: + - name: remove {{ remove }} + file: path={{ playbook_dir }}/{{ remove }} state=absent + roles: + - showfile + post_tasks: + - name: from play + set_fact: play_result="{{lookup('file', 'testfile')}}" + + - name: output stage {{ remove }} removed + debug: msg="play> {{play_out}}, role> {{role_out}}" + + - name: verify that result match expected + assert: + that: + - 'play_result == play_out' + - 'role_result == role_out' |