Add symlinks sanity test. (#46467)

* Add symlinks sanity test.
* Replace legacy test symlinks with actual content.
* Remove dir symlink from template_jinja2_latest.
* Update import test to use generated library dir.
* Fix copy test symlink setup.
This commit is contained in:
Matt Clay
2018-10-04 07:02:42 -07:00
committed by GitHub
parent a4961ff32a
commit e2b6047514
21 changed files with 259 additions and 16 deletions

View File

@@ -1 +0,0 @@
/tmp/ansible-test-abs-link

View File

@@ -1 +0,0 @@
/tmp/ansible-test-abs-link-dir

View File

@@ -1 +0,0 @@
../invalid

View File

@@ -1 +0,0 @@
/tmp/ansible-test-link-dir/out_of_tree_circle

View File

@@ -1 +0,0 @@
../subdir2/subdir3

View File

@@ -9,15 +9,25 @@
local_temp_dir: '{{ tempfile_result.stdout }}'
# output_dir is hardcoded in test/runner/lib/executor.py and created there
remote_dir: '{{ output_dir }}'
symlinks:
ansible-test-abs-link: /tmp/ansible-test-abs-link
ansible-test-abs-link-dir: /tmp/ansible-test-abs-link-dir
circles: ../
invalid: invalid
invalid2: ../invalid
out_of_tree_circle: /tmp/ansible-test-link-dir/out_of_tree_circle
subdir3: ../subdir2/subdir3
- file: path={{local_temp_dir}} state=directory
name: ensure temp dir exists
# file cannot do this properly, use command instead
- name: Create circular symbolic link
command: ln -s ../ circles
- name: Create symbolic link
command: "ln -s '{{ item.value }}' '{{ item.key }}'"
args:
chdir: '{{role_path}}/files/subdir/subdir1'
warn: no
with_dict: "{{ symlinks }}"
- name: Create remote unprivileged remote user
user:
@@ -55,11 +65,12 @@
state: absent
connection: local
- name: Remove circular symbolic link
- name: Remove symbolic link
file:
path: '{{ role_path }}/files/subdir/subdir1/circles'
path: '{{ role_path }}/files/subdir/subdir1/{{ item.key }}'
state: absent
connection: local
with_dict: "{{ symlinks }}"
- name: Remote unprivileged remote user
user:

View File

@@ -1 +0,0 @@
../../template

View File

@@ -18,4 +18,7 @@ source "${MYTMPDIR}/jinja2/bin/activate"
pip install -U jinja2
ANSIBLE_ROLES_PATH="$(dirname "$(pwd)")"
export ANSIBLE_ROLES_PATH
ansible-playbook -i ../../inventory main.yml -e @../../integration_config.yml -v "$@"