mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-11 02:25:36 +00:00
Use remote_tmp_dir for lookup_filetree integration test files
This commit is contained in:
parent
52e98362e7
commit
e2548df3df
3 changed files with 21 additions and 8 deletions
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
filetree_test_root: "{{ remote_tmp_dir }}/data"
|
||||
7
tests/integration/targets/lookup_filetree/meta/main.yml
Normal file
7
tests/integration/targets/lookup_filetree/meta/main.yml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
dependencies:
|
||||
- setup_remote_tmp_dir
|
||||
|
|
@ -13,27 +13,27 @@
|
|||
path: "{{ item }}"
|
||||
state: directory
|
||||
loop:
|
||||
- files/data
|
||||
- files/data/subdir
|
||||
- "{{ filetree_test_root }}"
|
||||
- "{{ filetree_test_root }}/subdir"
|
||||
|
||||
- name: Create test files
|
||||
ansible.builtin.copy:
|
||||
content: "{{ item.content }}"
|
||||
dest: "{{ item.dest }}"
|
||||
loop:
|
||||
- dest: files/data/app.conf
|
||||
- dest: "{{ filetree_test_root }}/app.conf"
|
||||
content: "content\n"
|
||||
- dest: files/data/subdir/nested.conf
|
||||
- dest: "{{ filetree_test_root }}/subdir/nested.conf"
|
||||
content: "nested\n"
|
||||
|
||||
- name: Create .git directory for exclude test
|
||||
ansible.builtin.file:
|
||||
path: files/data/.git
|
||||
path: "{{ filetree_test_root }}/.git"
|
||||
state: directory
|
||||
|
||||
- name: Lookup filetree without exclude
|
||||
ansible.builtin.set_fact:
|
||||
filetree_all: "{{ lookup('community.general.filetree', 'data/') }}"
|
||||
filetree_all: "{{ lookup('community.general.filetree', filetree_test_root ~ '/') }}"
|
||||
|
||||
- name: Verify all entries are listed
|
||||
ansible.builtin.assert:
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
- name: Lookup filetree with valid exclude regex
|
||||
ansible.builtin.set_fact:
|
||||
filetree_filtered: "{{ lookup('community.general.filetree', 'data/', exclude='^\\.git$') }}"
|
||||
filetree_filtered: "{{ lookup('community.general.filetree', filetree_test_root ~ '/', exclude='^\\.git$') }}"
|
||||
|
||||
- name: Verify exclude filters matching basenames
|
||||
ansible.builtin.assert:
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
|
||||
- name: Lookup filetree with invalid exclude regex
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('community.general.filetree', 'data/', exclude='temp[1') }}"
|
||||
msg: "{{ lookup('community.general.filetree', filetree_test_root ~ '/', exclude='temp[1') }}"
|
||||
ignore_errors: true
|
||||
register: invalid_exclude
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue