2017-06-19 12:57:26 +00:00
|
|
|
---
|
|
|
|
#### Tests for upgrade/download functions in modules/packaging/os/apt.py ####
|
|
|
|
- name: download and install old version of hello
|
2018-08-28 00:35:23 +00:00
|
|
|
apt: "deb=https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/apt/hello_{{ hello_old_version }}_amd64.deb"
|
2017-06-19 12:57:26 +00:00
|
|
|
|
|
|
|
- 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 }}"
|
|
|
|
|
2018-03-29 06:20:10 +00:00
|
|
|
- name: "(upgrade type: {{upgrade_type}}) upgrade packages to latest version, force_apt_get: {{force_apt_get}}"
|
2017-06-19 12:57:26 +00:00
|
|
|
apt:
|
|
|
|
upgrade: "{{ upgrade_type }}"
|
2018-03-29 06:20:10 +00:00
|
|
|
force_apt_get: "{{ force_apt_get }}"
|
2017-08-08 13:53:44 +00:00
|
|
|
register: upgrade_result
|
2017-06-19 12:57:26 +00:00
|
|
|
|
|
|
|
- name: check hello version
|
|
|
|
shell: dpkg -s hello | grep Version | awk '{print $2}'
|
|
|
|
register: hello_version
|
|
|
|
|
2017-08-08 13:53:44 +00:00
|
|
|
- name: check that warning is not given when force_apt_get set
|
|
|
|
assert:
|
|
|
|
that:
|
2018-03-29 06:20:10 +00:00
|
|
|
- "'warnings' not in upgrade_result"
|
2017-08-08 13:53:44 +00:00
|
|
|
when:
|
2018-03-29 06:20:10 +00:00
|
|
|
- force_apt_get
|
2017-08-08 13:53:44 +00:00
|
|
|
|
|
|
|
- name: check that warning is given when aptitude not found and force_apt_get not set
|
|
|
|
assert:
|
|
|
|
that:
|
2018-03-29 06:20:10 +00:00
|
|
|
- "'Could not find aptitude. Using apt-get instead' in upgrade_result.warnings[0]"
|
2017-08-08 13:53:44 +00:00
|
|
|
when:
|
2018-03-29 06:20:10 +00:00
|
|
|
- not aptitude_present
|
|
|
|
- not force_apt_get
|
2017-08-08 13:53:44 +00:00
|
|
|
|
2017-06-19 12:57:26 +00:00
|
|
|
- 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 }}"
|
2018-03-29 06:20:10 +00:00
|
|
|
force_apt_get: "{{ force_apt_get }}"
|
2017-08-08 13:53:44 +00:00
|
|
|
register: second_upgrade_result
|
2017-06-19 12:57:26 +00:00
|
|
|
|
|
|
|
- name: check that nothing has changed (Idempotant)
|
|
|
|
assert:
|
|
|
|
that:
|
2017-08-08 13:53:44 +00:00
|
|
|
- "second_upgrade_result.changed == false"
|
2017-06-19 12:57:26 +00:00
|
|
|
|
|
|
|
- name: remove hello
|
|
|
|
apt:
|
|
|
|
pkg: hello
|
|
|
|
state: absent
|
|
|
|
autoclean: yes
|