diff options
author | Matt Clay <matt@mystile.com> | 2019-08-14 00:12:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-14 00:12:05 -0700 |
commit | b07f96c31dec8fc47ad5c968bed8c495e948c97c (patch) | |
tree | cc9ea1d8a3910ff97e2bb204cd05b32ab0cdee42 /test/integration/targets | |
parent | ba1b4565d3d99e0a713664ce892aef91ef78283d (diff) | |
download | ansible-b07f96c31dec8fc47ad5c968bed8c495e948c97c.tar.gz |
Fix integration test temp dir usage. (#60555)
* Fix xfs_quota integration test temp dir usage.
* Fix lvg integration test temp dir usage.
* Fix filesystem integration test temp dir usage.
* Fix connection_windows_ssh test temp dir usage.
Diffstat (limited to 'test/integration/targets')
11 files changed, 62 insertions, 56 deletions
diff --git a/test/integration/targets/connection_windows_ssh/runme.sh b/test/integration/targets/connection_windows_ssh/runme.sh index e891be499a..9b7e2d6947 100755 --- a/test/integration/targets/connection_windows_ssh/runme.sh +++ b/test/integration/targets/connection_windows_ssh/runme.sh @@ -7,7 +7,7 @@ set -eux ### cmd tests - no DefaultShell set ### ansible -i ../../inventory.winrm localhost \ -m template \ - -a "src=test_connection.inventory.j2 dest=~/ansible_testing/test_connection.inventory" \ + -a "src=test_connection.inventory.j2 dest=${OUTPUT_DIR}/test_connection.inventory" \ -e "test_shell_type=cmd" \ "$@" @@ -18,7 +18,7 @@ ansible -i ../../inventory.winrm windows \ "$@" # Need to flush the connection to ensure we get a new shell for the next tests -ansible -i ~/ansible_testing/test_connection.inventory windows-ssh \ +ansible -i "${OUTPUT_DIR}/test_connection.inventory" windows-ssh \ -m meta -a "reset_connection" \ "$@" @@ -27,14 +27,14 @@ ansible -i ~/ansible_testing/test_connection.inventory windows-ssh \ # scp ANSIBLE_SCP_IF_SSH=true ./windows.sh "$@" # other tests not part of the generic connection test framework -ansible-playbook -i ~/ansible_testing/test_connection.inventory tests.yml \ +ansible-playbook -i "${OUTPUT_DIR}/test_connection.inventory" tests.yml \ "$@" ### powershell tests - explicit DefaultShell set ### # we do this last as the default shell on our CI instances is set to PowerShell ansible -i ../../inventory.winrm localhost \ -m template \ - -a "src=test_connection.inventory.j2 dest=~/ansible_testing/test_connection.inventory" \ + -a "src=test_connection.inventory.j2 dest=${OUTPUT_DIR}/test_connection.inventory" \ -e "test_shell_type=powershell" \ "$@" @@ -44,11 +44,11 @@ ansible -i ../../inventory.winrm windows \ -a "path=HKLM:\\\\SOFTWARE\\\\OpenSSH name=DefaultShell data=C:\\\\Windows\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe" \ "$@" -ansible -i ~/ansible_testing/test_connection.inventory windows-ssh \ +ansible -i "${OUTPUT_DIR}/test_connection.inventory" windows-ssh \ -m meta -a "reset_connection" \ "$@" ./windows.sh "$@" ANSIBLE_SCP_IF_SSH=true ./windows.sh "$@" -ansible-playbook -i ~/ansible_testing/test_connection.inventory tests.yml \ +ansible-playbook -i "${OUTPUT_DIR}/test_connection.inventory" tests.yml \ "$@" diff --git a/test/integration/targets/connection_windows_ssh/windows.sh b/test/integration/targets/connection_windows_ssh/windows.sh index e3ece7f5f7..83895d07ad 100755 --- a/test/integration/targets/connection_windows_ssh/windows.sh +++ b/test/integration/targets/connection_windows_ssh/windows.sh @@ -10,7 +10,7 @@ cd ../connection # container has been updated. # https://unix.stackexchange.com/questions/499958/why-does-scps-strict-filename-checking-reject-quoted-last-component-but-not-oth # https://github.com/openssh/openssh-portable/commit/391ffc4b9d31fa1f4ad566499fef9176ff8a07dc -INVENTORY=~/ansible_testing/test_connection.inventory ./test.sh \ +INVENTORY="${OUTPUT_DIR}/test_connection.inventory" ./test.sh \ -e target_hosts=windows-ssh \ -e action_prefix=win_ \ -e local_tmp=/tmp/ansible-local \ @@ -20,6 +20,6 @@ INVENTORY=~/ansible_testing/test_connection.inventory ./test.sh \ cd ../connection_windows_ssh -ansible-playbook -i ~/ansible_testing/test_connection.inventory tests_fetch.yml \ +ansible-playbook -i "${OUTPUT_DIR}/test_connection.inventory" tests_fetch.yml \ -e ansible_scp_extra_args=-T \ "$@" diff --git a/test/integration/targets/filesystem/meta/main.yml b/test/integration/targets/filesystem/meta/main.yml new file mode 100644 index 0000000000..1810d4bec9 --- /dev/null +++ b/test/integration/targets/filesystem/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - setup_remote_tmp_dir diff --git a/test/integration/targets/filesystem/tasks/main.yml b/test/integration/targets/filesystem/tasks/main.yml index e352944ba0..68d625e897 100644 --- a/test/integration/targets/filesystem/tasks/main.yml +++ b/test/integration/targets/filesystem/tasks/main.yml @@ -15,7 +15,7 @@ - include_tasks: create_device.yml vars: - image_file: '{{ ansible_user_dir }}/ansible_testing/img' + image_file: '{{ remote_tmp_dir }}/img' fstype: '{{ item.0.key }}' fssize: '{{ item.0.value.fssize }}' grow: '{{ item.0.value.grow }}' diff --git a/test/integration/targets/lvg/meta/main.yml b/test/integration/targets/lvg/meta/main.yml new file mode 100644 index 0000000000..1810d4bec9 --- /dev/null +++ b/test/integration/targets/lvg/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - setup_remote_tmp_dir diff --git a/test/integration/targets/lvg/tasks/setup.yml b/test/integration/targets/lvg/tasks/setup.yml index 29f29d6e9c..e63c2d641e 100644 --- a/test/integration/targets/lvg/tasks/setup.yml +++ b/test/integration/targets/lvg/tasks/setup.yml @@ -1,9 +1,9 @@ - name: "Create files to use as a disk devices" - command: "dd if=/dev/zero of={{ ansible_user_dir }}/ansible_testing/img{{ item }} bs=1M count=10" + command: "dd if=/dev/zero of={{ remote_tmp_dir }}/img{{ item }} bs=1M count=10" with_sequence: 'count=2' - name: "Create loop device for file" - command: "losetup --show -f {{ ansible_user_dir }}/ansible_testing/img{{ item }}" + command: "losetup --show -f {{ remote_tmp_dir }}/img{{ item }}" with_sequence: 'count=2' register: loop_devices diff --git a/test/integration/targets/lvg/tasks/teardown.yml b/test/integration/targets/lvg/tasks/teardown.yml index 71aa4e8907..ed662f1e1f 100644 --- a/test/integration/targets/lvg/tasks/teardown.yml +++ b/test/integration/targets/lvg/tasks/teardown.yml @@ -12,6 +12,6 @@ - name: Remove device files file: - path: "{{ ansible_user_dir }}/ansible_testing/img{{ item }}" + path: "{{ remote_tmp_dir }}/img{{ item }}" state: absent with_sequence: 'count={{ loop_devices.results|length }}' diff --git a/test/integration/targets/xfs_quota/meta/main.yml b/test/integration/targets/xfs_quota/meta/main.yml new file mode 100644 index 0000000000..1810d4bec9 --- /dev/null +++ b/test/integration/targets/xfs_quota/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - setup_remote_tmp_dir diff --git a/test/integration/targets/xfs_quota/tasks/gquota.yml b/test/integration/targets/xfs_quota/tasks/gquota.yml index 03e672358d..6d0310205b 100644 --- a/test/integration/targets/xfs_quota/tasks/gquota.yml +++ b/test/integration/targets/xfs_quota/tasks/gquota.yml @@ -1,19 +1,19 @@ --- - name: 'Create disk image' command: > - dd if=/dev/zero of={{ ansible_user_dir }}/ansible_testing/img-gquota bs=1M count=20 + dd if=/dev/zero of={{ remote_tmp_dir }}/img-gquota bs=1M count=20 - name: 'Create XFS filesystem' filesystem: - dev: '{{ ansible_user_dir }}/ansible_testing/img-gquota' + dev: '{{ remote_tmp_dir }}/img-gquota' fstype: xfs - block: - name: 'Mount filesystem' mount: - fstab: '{{ ansible_user_dir }}/ansible_testing/fstab' - src: '{{ ansible_user_dir }}/ansible_testing/img-gquota' - path: '{{ ansible_user_dir }}/ansible_testing/gquota' + fstab: '{{ remote_tmp_dir }}/fstab' + src: '{{ remote_tmp_dir }}/img-gquota' + path: '{{ remote_tmp_dir }}/gquota' fstype: xfs opts: gquota state: mounted @@ -25,7 +25,7 @@ bhard: '{{ gquota_default_bhard }}' isoft: '{{ gquota_default_isoft }}' ihard: '{{ gquota_default_ihard }}' - mountpoint: '{{ ansible_user_dir }}/ansible_testing/gquota' + mountpoint: '{{ remote_tmp_dir }}/gquota' rtbsoft: '{{ gquota_default_rtbsoft }}' rtbhard: '{{ gquota_default_rtbhard }}' type: group @@ -49,7 +49,7 @@ bhard: '{{ gquota_group_bhard }}' isoft: '{{ gquota_group_isoft }}' ihard: '{{ gquota_group_ihard }}' - mountpoint: '{{ ansible_user_dir }}/ansible_testing/gquota' + mountpoint: '{{ remote_tmp_dir }}/gquota' name: xfsquotauser rtbsoft: '{{ gquota_group_rtbsoft }}' rtbhard: '{{ gquota_group_rtbhard }}' @@ -74,7 +74,7 @@ bhard: '{{ gquota_default_bhard }}' isoft: '{{ gquota_default_isoft }}' ihard: '{{ gquota_default_ihard }}' - mountpoint: '{{ ansible_user_dir }}/ansible_testing/gquota' + mountpoint: '{{ remote_tmp_dir }}/gquota' rtbsoft: '{{ gquota_default_rtbsoft }}' rtbhard: '{{ gquota_default_rtbhard }}' type: group @@ -92,7 +92,7 @@ bhard: '{{ gquota_group_bhard }}' isoft: '{{ gquota_group_isoft }}' ihard: '{{ gquota_group_ihard }}' - mountpoint: '{{ ansible_user_dir }}/ansible_testing/gquota' + mountpoint: '{{ remote_tmp_dir }}/gquota' name: xfsquotauser rtbsoft: '{{ gquota_group_rtbsoft }}' rtbhard: '{{ gquota_group_rtbhard }}' @@ -107,7 +107,7 @@ - name: 'Reset default group limits' xfs_quota: - mountpoint: '{{ ansible_user_dir }}/ansible_testing/gquota' + mountpoint: '{{ remote_tmp_dir }}/gquota' state: absent type: group become: True @@ -126,7 +126,7 @@ - name: 'Reset group limits for xfsquotauser' xfs_quota: - mountpoint: '{{ ansible_user_dir }}/ansible_testing/gquota' + mountpoint: '{{ remote_tmp_dir }}/gquota' name: xfsquotauser state: absent type: group @@ -147,12 +147,12 @@ always: - name: 'Unmount filesystem' mount: - fstab: '{{ ansible_user_dir }}/ansible_testing/fstab' - path: '{{ ansible_user_dir }}/ansible_testing/gquota' + fstab: '{{ remote_tmp_dir }}/fstab' + path: '{{ remote_tmp_dir }}/gquota' state: unmounted become: True - name: Remove disk image file: - path: '{{ ansible_user_dir }}/ansible_testing/img-gquota' + path: '{{ remote_tmp_dir }}/img-gquota' state: absent diff --git a/test/integration/targets/xfs_quota/tasks/pquota.yml b/test/integration/targets/xfs_quota/tasks/pquota.yml index 3ae3a8a32c..5061fca999 100644 --- a/test/integration/targets/xfs_quota/tasks/pquota.yml +++ b/test/integration/targets/xfs_quota/tasks/pquota.yml @@ -1,11 +1,11 @@ --- - name: 'Create disk image' command: > - dd if=/dev/zero of={{ ansible_user_dir }}/ansible_testing/img-pquota bs=1M count=20 + dd if=/dev/zero of={{ remote_tmp_dir }}/img-pquota bs=1M count=20 - name: 'Create XFS filesystem' filesystem: - dev: '{{ ansible_user_dir }}/ansible_testing/img-pquota' + dev: '{{ remote_tmp_dir }}/img-pquota' fstype: xfs - name: Create xfs related files @@ -27,16 +27,16 @@ - name: 'Add test xfs quota project path' lineinfile: path: /etc/projects - line: '99999:{{ ansible_user_dir }}/ansible_testing/pquota/test' + line: '99999:{{ remote_tmp_dir }}/pquota/test' state: present become: True - block: - name: 'Mount filesystem' mount: - fstab: '{{ ansible_user_dir }}/ansible_testing/fstab' - src: '{{ ansible_user_dir }}/ansible_testing/img-pquota' - path: '{{ ansible_user_dir }}/ansible_testing/pquota' + fstab: '{{ remote_tmp_dir }}/fstab' + src: '{{ remote_tmp_dir }}/img-pquota' + path: '{{ remote_tmp_dir }}/pquota' fstype: xfs opts: pquota state: mounted @@ -44,7 +44,7 @@ - name: 'Create test directory' file: - path: '{{ ansible_user_dir }}/ansible_testing/pquota/test' + path: '{{ remote_tmp_dir }}/pquota/test' state: directory become: True @@ -55,7 +55,7 @@ bhard: '{{ pquota_default_bhard }}' isoft: '{{ pquota_default_isoft }}' ihard: '{{ pquota_default_ihard }}' - mountpoint: '{{ ansible_user_dir }}/ansible_testing/pquota' + mountpoint: '{{ remote_tmp_dir }}/pquota' rtbsoft: '{{ pquota_default_rtbsoft }}' rtbhard: '{{ pquota_default_rtbhard }}' type: project @@ -79,7 +79,7 @@ bhard: '{{ pquota_project_bhard }}' isoft: '{{ pquota_project_isoft }}' ihard: '{{ pquota_project_ihard }}' - mountpoint: '{{ ansible_user_dir }}/ansible_testing/pquota' + mountpoint: '{{ remote_tmp_dir }}/pquota' name: xft_quotaval rtbsoft: '{{ pquota_project_rtbsoft }}' rtbhard: '{{ pquota_project_rtbhard }}' @@ -104,7 +104,7 @@ bhard: '{{ pquota_default_bhard }}' isoft: '{{ pquota_default_isoft }}' ihard: '{{ pquota_default_ihard }}' - mountpoint: '{{ ansible_user_dir }}/ansible_testing/pquota' + mountpoint: '{{ remote_tmp_dir }}/pquota' rtbsoft: '{{ pquota_default_rtbsoft }}' rtbhard: '{{ pquota_default_rtbhard }}' type: project @@ -122,7 +122,7 @@ bhard: '{{ pquota_project_bhard }}' isoft: '{{ pquota_project_isoft }}' ihard: '{{ pquota_project_ihard }}' - mountpoint: '{{ ansible_user_dir }}/ansible_testing/pquota' + mountpoint: '{{ remote_tmp_dir }}/pquota' name: xft_quotaval rtbsoft: '{{ pquota_project_rtbsoft }}' rtbhard: '{{ pquota_project_rtbhard }}' @@ -137,7 +137,7 @@ - name: 'Reset default project limits' xfs_quota: - mountpoint: '{{ ansible_user_dir }}/ansible_testing/pquota' + mountpoint: '{{ remote_tmp_dir }}/pquota' state: absent type: project become: True @@ -156,7 +156,7 @@ - name: 'Reset project limits for xft_quotaval' xfs_quota: - mountpoint: '{{ ansible_user_dir }}/ansible_testing/pquota' + mountpoint: '{{ remote_tmp_dir }}/pquota' name: xft_quotaval state: absent type: project @@ -177,14 +177,14 @@ always: - name: 'Unmount filesystem' mount: - fstab: '{{ ansible_user_dir }}/ansible_testing/fstab' - path: '{{ ansible_user_dir }}/ansible_testing/pquota' + fstab: '{{ remote_tmp_dir }}/fstab' + path: '{{ remote_tmp_dir }}/pquota' state: unmounted become: True - name: Remove disk image file: - path: '{{ ansible_user_dir }}/ansible_testing/img-pquota' + path: '{{ remote_tmp_dir }}/img-pquota' state: absent - name: Remove xfs quota project id diff --git a/test/integration/targets/xfs_quota/tasks/uquota.yml b/test/integration/targets/xfs_quota/tasks/uquota.yml index 8f14464db4..04cd87f2f7 100644 --- a/test/integration/targets/xfs_quota/tasks/uquota.yml +++ b/test/integration/targets/xfs_quota/tasks/uquota.yml @@ -1,19 +1,19 @@ --- - name: 'Create disk image' command: > - dd if=/dev/zero of={{ ansible_user_dir }}/ansible_testing/img-uquota bs=1M count=20 + dd if=/dev/zero of={{ remote_tmp_dir }}/img-uquota bs=1M count=20 - name: 'Create XFS filesystem' filesystem: - dev: '{{ ansible_user_dir }}/ansible_testing/img-uquota' + dev: '{{ remote_tmp_dir }}/img-uquota' fstype: xfs - block: - name: 'Mount filesystem' mount: - fstab: '{{ ansible_user_dir }}/ansible_testing/fstab' - src: '{{ ansible_user_dir }}/ansible_testing/img-uquota' - path: '{{ ansible_user_dir }}/ansible_testing/uquota' + fstab: '{{ remote_tmp_dir }}/fstab' + src: '{{ remote_tmp_dir }}/img-uquota' + path: '{{ remote_tmp_dir }}/uquota' fstype: xfs opts: uquota state: mounted @@ -25,7 +25,7 @@ bhard: '{{ uquota_default_bhard }}' isoft: '{{ uquota_default_isoft }}' ihard: '{{ uquota_default_ihard }}' - mountpoint: '{{ ansible_user_dir }}/ansible_testing/uquota' + mountpoint: '{{ remote_tmp_dir }}/uquota' rtbsoft: '{{ uquota_default_rtbsoft }}' rtbhard: '{{ uquota_default_rtbhard }}' type: user @@ -49,7 +49,7 @@ bhard: '{{ uquota_user_bhard }}' isoft: '{{ uquota_user_isoft }}' ihard: '{{ uquota_user_ihard }}' - mountpoint: '{{ ansible_user_dir }}/ansible_testing/uquota' + mountpoint: '{{ remote_tmp_dir }}/uquota' name: xfsquotauser rtbsoft: '{{ uquota_user_rtbsoft }}' rtbhard: '{{ uquota_user_rtbhard }}' @@ -74,7 +74,7 @@ bhard: '{{ uquota_default_bhard }}' isoft: '{{ uquota_default_isoft }}' ihard: '{{ uquota_default_ihard }}' - mountpoint: '{{ ansible_user_dir }}/ansible_testing/uquota' + mountpoint: '{{ remote_tmp_dir }}/uquota' rtbsoft: '{{ uquota_default_rtbsoft }}' rtbhard: '{{ uquota_default_rtbhard }}' type: user @@ -92,7 +92,7 @@ bhard: '{{ uquota_user_bhard }}' isoft: '{{ uquota_user_isoft }}' ihard: '{{ uquota_user_ihard }}' - mountpoint: '{{ ansible_user_dir }}/ansible_testing/uquota' + mountpoint: '{{ remote_tmp_dir }}/uquota' name: xfsquotauser rtbsoft: '{{ uquota_user_rtbsoft }}' rtbhard: '{{ uquota_user_rtbhard }}' @@ -107,7 +107,7 @@ - name: 'Reset default user limits' xfs_quota: - mountpoint: '{{ ansible_user_dir }}/ansible_testing/uquota' + mountpoint: '{{ remote_tmp_dir }}/uquota' state: absent type: user become: True @@ -126,7 +126,7 @@ - name: 'Reset user limits for xfsquotauser' xfs_quota: - mountpoint: '{{ ansible_user_dir }}/ansible_testing/uquota' + mountpoint: '{{ remote_tmp_dir }}/uquota' name: xfsquotauser state: absent type: user @@ -147,12 +147,12 @@ always: - name: 'Unmount filesystem' mount: - fstab: '{{ ansible_user_dir }}/ansible_testing/fstab' - path: '{{ ansible_user_dir }}/ansible_testing/uquota' + fstab: '{{ remote_tmp_dir }}/fstab' + path: '{{ remote_tmp_dir }}/uquota' state: unmounted become: True - name: Remove disk image file: - path: '{{ ansible_user_dir }}/ansible_testing/img-uquota' + path: '{{ remote_tmp_dir }}/img-uquota' state: absent |