1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-03 23:41:51 +00:00
community.general/tests/integration/targets/decompress/tasks/main.yml
Felix Fontein 21122e926b
Remove Python 2 specific parts from integration tests (#10897)
* Remove Python 2 specific parts from integration tests.

* Remove more constraints.
2025-10-12 08:48:50 +02:00

90 lines
2.2 KiB
YAML

---
# 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
- name: Copy test files
copy:
src: "files/"
dest: "{{ remote_tmp_dir }}"
- name: Get original file stat
stat:
path: "{{ remote_tmp_dir }}/file.txt"
register: orig_file_stat
- name: Set supported formats
set_fact:
formats:
- bz2
- gz
- xz
- name: Ensure xz is present to create compressed files (not Debian)
package:
name:
- xz
- bzip2
state: latest
when:
- ansible_system != 'FreeBSD'
- ansible_os_family != 'Darwin'
- ansible_os_family != 'Debian'
- name: Ensure xz is present to create compressed files (Debian)
package:
name: xz-utils
state: latest
when: ansible_os_family == 'Debian'
- name: Ensure xz is present to create compressed file (macOS)
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: false
become: true
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_os_family == 'Darwin'
- name: Generate compressed files
shell: |
gzip < {{ item }} > {{ item }}.gz
bzip2 < {{ item }} > {{ item }}.bz2
xz < {{ item }} > {{ item }}.xz
loop:
- "{{ remote_tmp_dir }}/file.txt"
- "{{ remote_tmp_dir }}/second_file.txt"
# Run tests
- name: Run core tests
block:
- include_tasks: core.yml
loop: "{{ formats }}"
loop_control:
loop_var: format
- import_tasks: cleanup.yml
- name: Run idempotency and check mode tests
block:
- import_tasks: misc.yml
- import_tasks: cleanup.yml
- name: Run tests for destination file
block:
- import_tasks: dest.yml
- import_tasks: cleanup.yml