mirror of https://github.com/ansible/ansible.git
added integration tests for apt upgrade (#25670)
* added integration tests for apt upgrade changed version number for hello to 2.6 so that it works with Ubuntu 12.04 prevent tests from checking if aptitude is installed on non ubuntu systems changed ordering on when statements for safe and full upgrade types so that the OS check happens before the aptitude check added integration tests for apt upgrade changed version number for hello to 2.6 so that it works with Ubuntu 12.04 * Moved additions to tasks/main.yml to make revisions easier. Changed tasks to multiline formatpull/25866/head
parent
0be0aa5f10
commit
ca16956337
@ -1 +1,2 @@
|
||||
apt_foreign_arch: i386
|
||||
hello_old_version: 2.6-1
|
||||
|
@ -0,0 +1,45 @@
|
||||
---
|
||||
#### 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
|
||||
|
||||
- debug: var=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"
|
||||
apt:
|
||||
upgrade: "{{ upgrade_type }}"
|
||||
|
||||
- name: check hello version
|
||||
shell: dpkg -s hello | grep Version | awk '{print $2}'
|
||||
register: hello_version
|
||||
|
||||
- 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 }}"
|
||||
register: result
|
||||
|
||||
- name: check that nothing has changed (Idempotant)
|
||||
assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: remove hello
|
||||
apt:
|
||||
pkg: hello
|
||||
state: absent
|
||||
autoclean: yes
|
Loading…
Reference in New Issue