mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
7c43cc3faa
* Remove superfluous test. * Use remote_temp_dir instead of output_dir on remote. * Read certificate from correct place. * Adjust more places. * Fix boolean. * Improve cryptography setup. * Fix java_keystore changes. * Need to copy binary from remote. * Use correct Python for serve script. * Sleep before downloading. * Use correct Python interpreter. * Avoid failing shebang test. * Fix permission error with macOS 11.1. * Avoid shebang trouble.
134 lines
3.9 KiB
YAML
134 lines
3.9 KiB
YAML
####################################################################
|
|
# WARNING: These are designed specifically for Ansible tests #
|
|
# and should not be used as examples of how to write Ansible roles #
|
|
####################################################################
|
|
|
|
# Test code for the archive module.
|
|
# (c) 2017, Abhijeet Kasurde <akasurde@redhat.com>
|
|
|
|
# This file is part of Ansible
|
|
#
|
|
# Ansible is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Ansible is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
# Make sure we start fresh
|
|
|
|
# Test setup
|
|
- name: Ensure zip is present to create test archive (yum)
|
|
yum: name=zip state=latest
|
|
when: ansible_facts.pkg_mgr == 'yum'
|
|
|
|
- name: Ensure zip is present to create test archive (apt)
|
|
apt: name=zip state=latest
|
|
when: ansible_facts.pkg_mgr == 'apt'
|
|
|
|
- name: Install prerequisites for backports.lzma when using python2 (non OSX)
|
|
block:
|
|
- name: Set liblzma package name depending on the OS
|
|
set_fact:
|
|
liblzma_dev_package:
|
|
Debian: liblzma-dev
|
|
RedHat: xz-devel
|
|
Suse: xz-devel
|
|
- name: Ensure liblzma-dev is present to install backports-lzma
|
|
package: name={{ liblzma_dev_package[ansible_os_family] }} state=latest
|
|
when: ansible_os_family in liblzma_dev_package.keys()
|
|
when:
|
|
- ansible_python_version.split('.')[0] == '2'
|
|
- ansible_os_family != 'Darwin'
|
|
|
|
- name: Install prerequisites for backports.lzma when using python2 (OSX)
|
|
block:
|
|
- name: Find brew binary
|
|
command: which brew
|
|
register: brew_which
|
|
- name: Get owner of brew binary
|
|
stat: path="{{ brew_which.stdout }}"
|
|
register: brew_stat
|
|
- name: "Install package"
|
|
homebrew:
|
|
name: xz
|
|
state: present
|
|
update_homebrew: no
|
|
become: yes
|
|
become_user: "{{ brew_stat.stat.pw_name }}"
|
|
# Newer versions of brew want to compile a package which takes a long time. Do not upgrade homebrew until a
|
|
# proper solution can be found
|
|
environment:
|
|
HOMEBREW_NO_AUTO_UPDATE: True
|
|
when:
|
|
- ansible_python_version.split('.')[0] == '2'
|
|
- ansible_os_family == 'Darwin'
|
|
|
|
- name: Ensure backports.lzma is present to create test archive (pip)
|
|
pip: name=backports.lzma state=latest
|
|
when: ansible_python_version.split('.')[0] == '2'
|
|
register: backports_lzma_pip
|
|
|
|
- name: prep our files
|
|
copy: src={{ item }} dest={{remote_tmp_dir}}/{{ item }}
|
|
with_items:
|
|
- foo.txt
|
|
- bar.txt
|
|
- empty.txt
|
|
- sub
|
|
- sub/subfile.txt
|
|
|
|
- name: Define formats to test
|
|
set_fact:
|
|
formats:
|
|
- tar
|
|
- zip
|
|
- gz
|
|
- bz2
|
|
- xz
|
|
|
|
# Run tests
|
|
- name: Run core tests
|
|
include_tasks:
|
|
file: ../tests/core.yml
|
|
loop: "{{ formats }}"
|
|
loop_control:
|
|
loop_var: format
|
|
|
|
- name: Run exclusions tests
|
|
include_tasks:
|
|
file: ../tests/exclusions.yml
|
|
loop: "{{ formats }}"
|
|
loop_control:
|
|
loop_var: format
|
|
|
|
- name: Run remove tests
|
|
include_tasks:
|
|
file: ../tests/remove.yml
|
|
loop: "{{ formats }}"
|
|
loop_control:
|
|
loop_var: format
|
|
|
|
- name: Run broken link tests
|
|
include_tasks:
|
|
file: ../tests/broken-link.yml
|
|
loop: "{{ formats }}"
|
|
loop_control:
|
|
loop_var: format
|
|
|
|
- name: Run Idempotency tests
|
|
include_tasks:
|
|
file: ../tests/idempotency.yml
|
|
loop: "{{ formats }}"
|
|
loop_control:
|
|
loop_var: format
|
|
|
|
# Test cleanup
|
|
- name: Remove backports.lzma if previously installed (pip)
|
|
pip: name=backports.lzma state=absent
|
|
when: backports_lzma_pip is changed
|