mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
73d3ed85ef
* Fix apt tests * Enable the test in CI * Additional fixes not discovered locally * Don't break mysql tests and fix for 14.04 upgrade * Remove not needed when cond * Add shebang to fix-udev script * Remove workaround in favor of rebuilding containers * Remove leftover script
61 lines
1.8 KiB
YAML
61 lines
1.8 KiB
YAML
---
|
|
#### Tests for upgrade/download functions in modules/packaging/os/apt.py ####
|
|
- name: download and install old version of hello
|
|
apt: "deb=https://launchpad.net/ubuntu/+archive/primary/+files/hello_{{ hello_old_version }}_amd64.deb"
|
|
|
|
- name: check hello version
|
|
shell: dpkg -s hello | grep Version | awk '{print $2}'
|
|
register: hello_version
|
|
|
|
- name: ensure the correct version of hello has been installed
|
|
assert:
|
|
that:
|
|
- "{{ hello_version.stdout }}=={{ hello_old_version }}"
|
|
|
|
- name: "(upgrade type: {{upgrade_type}}) upgrade packages to latest version, force_apt_get: {{force_apt_get}}"
|
|
apt:
|
|
upgrade: "{{ upgrade_type }}"
|
|
force_apt_get: "{{ force_apt_get }}"
|
|
register: upgrade_result
|
|
|
|
- name: check hello version
|
|
shell: dpkg -s hello | grep Version | awk '{print $2}'
|
|
register: hello_version
|
|
|
|
- name: check that warning is not given when force_apt_get set
|
|
assert:
|
|
that:
|
|
- "'warnings' not in upgrade_result"
|
|
when:
|
|
- force_apt_get
|
|
|
|
- name: check that warning is given when aptitude not found and force_apt_get not set
|
|
assert:
|
|
that:
|
|
- "'Could not find aptitude. Using apt-get instead' in upgrade_result.warnings[0]"
|
|
when:
|
|
- not aptitude_present
|
|
- not force_apt_get
|
|
|
|
- name: check that old version upgraded correctly
|
|
assert:
|
|
that:
|
|
- "{{ hello_version.stdout }}!={{ hello_old_version }}"
|
|
- "{{ hello_version.changed }}"
|
|
|
|
- name: "(upgrade type: {{upgrade_type}}) upgrade packages to latest version (Idempotant)"
|
|
apt:
|
|
upgrade: "{{ upgrade_type }}"
|
|
force_apt_get: "{{ force_apt_get }}"
|
|
register: second_upgrade_result
|
|
|
|
- name: check that nothing has changed (Idempotant)
|
|
assert:
|
|
that:
|
|
- "second_upgrade_result.changed == false"
|
|
|
|
- name: remove hello
|
|
apt:
|
|
pkg: hello
|
|
state: absent
|
|
autoclean: yes
|