1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/pkgng/tasks/create-outofdate-pkg.yml
Ross Williams 8805f408d6 pkgng: refactor tests for task reuse
Several tests need to install an out-of-date package
to test whether upgrades occur successfully, so this
commit refactors out the generation of the test package.

Also, factor out things like the name and path of the
test package so that is more maintainable should the
target test package (currently `zsh`) ever need to
change.
2021-10-11 17:10:35 +00:00

34 lines
1.2 KiB
YAML

---
- name: Check if out-of-date test package has already been created
stat:
path: '{{ pkgng_test_outofdate_pkg_path }}'
register: pkgng_test_outofdate_pkg_stat
- name: Create out-of-date test package
when: not pkgng_test_outofdate_pkg_stat.stat.exists
block:
- set_fact:
pkgng_test_outofdate_pkg_tempdir: '{{ pkgng_test_outofdate_pkg_path }}__tempdir'
- name: Create temporary directory to assemble test package
file:
state: directory
path: '{{ pkgng_test_outofdate_pkg_tempdir }}'
- name: Copy intentionally out-of-date package manifests to testhost
copy:
src: zsh_test_package_manifests/{{ item }}
# Plus-sign must be added at the destination
# CI doesn't like files with '+' in them in the repository
dest: '{{ pkgng_test_outofdate_pkg_tempdir }}/+{{ item }}'
loop:
- COMPACT_MANIFEST
- MANIFEST
- name: Create out-of-date test package file
command: 'tar -C {{ pkgng_test_outofdate_pkg_tempdir }} -cJf {{ pkgng_test_outofdate_pkg_path }} +COMPACT_MANIFEST +MANIFEST'
- name: Remove temporary directory
file:
state: absent
path: '{{ pkgng_test_outofdate_pkg_tempdir }}'