Fix apt tests (#37922)
* 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
This commit is contained in:
parent
0efbb702b9
commit
73d3ed85ef
4 changed files with 59 additions and 79 deletions
|
@ -1,3 +1,4 @@
|
|||
posix/ci/group1
|
||||
destructive
|
||||
skip/freebsd
|
||||
skip/osx
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
- name: show python version
|
||||
debug: var=ansible_python_version
|
||||
|
||||
- name: use python-apt
|
||||
set_fact:
|
||||
python_apt: python-apt
|
||||
|
@ -62,9 +59,6 @@
|
|||
failed_when: False
|
||||
register: dpkg_result
|
||||
|
||||
- debug: var=apt_result
|
||||
- debug: var=dpkg_result
|
||||
|
||||
- name: verify installation of hello
|
||||
assert:
|
||||
that:
|
||||
|
@ -104,9 +98,6 @@
|
|||
failed_when: False
|
||||
register: dpkg_result
|
||||
|
||||
- debug: var=apt_result
|
||||
- debug: var=dpkg_result
|
||||
|
||||
- name: verify installation of hello
|
||||
assert:
|
||||
that:
|
||||
|
@ -177,7 +168,7 @@
|
|||
- name: verify sane error message
|
||||
assert:
|
||||
that:
|
||||
- "'E:Failed to fetch' in apt_result['msg']"
|
||||
- "'Failed to fetch' in apt_result['msg']"
|
||||
- "'403' in apt_result['msg']"
|
||||
|
||||
- name: Clean up
|
||||
|
|
|
@ -15,69 +15,63 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- include: 'apt.yml'
|
||||
when: ansible_distribution in ('Ubuntu', 'Debian')
|
||||
- block:
|
||||
- include: 'apt.yml'
|
||||
|
||||
- block:
|
||||
- include: 'repo.yml'
|
||||
always:
|
||||
- apt_repository:
|
||||
repo: "deb file:{{ repodir }} ./"
|
||||
state: absent
|
||||
- file:
|
||||
name: "{{ repodir }}"
|
||||
state: absent
|
||||
when: ansible_distribution in ('Ubuntu', 'Debian')
|
||||
- block:
|
||||
- include: 'repo.yml'
|
||||
always:
|
||||
- apt_repository:
|
||||
repo: "deb file:{{ repodir }} ./"
|
||||
state: absent
|
||||
- file:
|
||||
name: "{{ repodir }}"
|
||||
state: absent
|
||||
|
||||
- include: 'apt-multiarch.yml'
|
||||
when: ansible_distribution in ('Ubuntu', 'Debian') and ansible_userspace_architecture != apt_foreign_arch
|
||||
- include: 'apt-multiarch.yml'
|
||||
when:
|
||||
- ansible_userspace_architecture != apt_foreign_arch
|
||||
|
||||
- include: 'apt-builddep.yml'
|
||||
when: ansible_distribution in ('Ubuntu', 'Debian')
|
||||
- include: 'apt-builddep.yml'
|
||||
|
||||
- include: upgrade.yml upgrade_type=dist
|
||||
when: ansible_distribution in ('Ubuntu', 'Debian')
|
||||
- include: "upgrade.yml aptitude_present={{ True | bool }} upgrade_type=dist force_apt_get={{ False | bool }}"
|
||||
|
||||
- name: Check if aptitude is installed
|
||||
command: dpkg-query --show --showformat='${db:Status-Abbrev}' aptitude
|
||||
register: aptitude_status
|
||||
when: ansible_distribution in ('Ubuntu', 'Debian')
|
||||
- name: Check if aptitude is installed
|
||||
command: dpkg-query --show --showformat='${db:Status-Abbrev}' aptitude
|
||||
register: aptitude_status
|
||||
|
||||
- debug: var=aptitude_status.stdout
|
||||
- name: Remove aptitude, if installed, to test fall-back to apt-get
|
||||
apt:
|
||||
pkg: aptitude
|
||||
state: absent
|
||||
when:
|
||||
- aptitude_status.stdout.find('ii') != -1
|
||||
|
||||
- name: Remove aptitude, if installed, to test fall-back to apt-get
|
||||
apt:
|
||||
pkg: aptitude
|
||||
state: absent
|
||||
when:
|
||||
- aptitude_status.stdout.find('ii') != -1
|
||||
- include: "upgrade.yml aptitude_present={{ False | bool }} upgrade_type={{ item.upgrade_type }} force_apt_get={{ item.force_apt_get }}"
|
||||
with_items:
|
||||
- { upgrade_type: safe, force_apt_get: False }
|
||||
- { upgrade_type: full, force_apt_get: False }
|
||||
- { upgrade_type: safe, force_apt_get: True }
|
||||
- { upgrade_type: full, force_apt_get: True }
|
||||
|
||||
- include: "upgrade.yml aptitude_present={{ False | bool }} upgrade_type={{ item.upgrade_type }} force_apt_get={{ item.force_apt_get }}"
|
||||
when:
|
||||
- ansible_distribution in ('Ubuntu', 'Debian')
|
||||
with_items:
|
||||
- { upgrade_type: safe, force_apt_get: False }
|
||||
- { upgrade_type: full, force_apt_get: False }
|
||||
- { upgrade_type: safe, force_apt_get: True }
|
||||
- { upgrade_type: full, force_apt_get: True }
|
||||
- name: (Re-)Install aptitude, run same tests again
|
||||
apt:
|
||||
pkg: aptitude
|
||||
state: present
|
||||
|
||||
- name: (Re-)Install aptitude, run same tests again
|
||||
apt:
|
||||
pkg: aptitude
|
||||
state: present
|
||||
- include: "upgrade.yml aptitude_present={{ True | bool }} upgrade_type={{ item.upgrade_type }} force_apt_get={{ item.force_apt_get }}"
|
||||
with_items:
|
||||
- { upgrade_type: safe, force_apt_get: False }
|
||||
- { upgrade_type: full, force_apt_get: False }
|
||||
- { upgrade_type: safe, force_apt_get: True }
|
||||
- { upgrade_type: full, force_apt_get: True }
|
||||
|
||||
- include: upgrade.yml upgrade_type={{ item.upgrade_type }} force_apt_get={{ item.force_apt_get }}
|
||||
when:
|
||||
- ansible_distribution in ('Ubuntu', 'Debian')
|
||||
with_items:
|
||||
- { upgrade_type: safe, force_apt_get: False }
|
||||
- { upgrade_type: full, force_apt_get: False }
|
||||
- { upgrade_type: safe, force_apt_get: True }
|
||||
- { upgrade_type: full, force_apt_get: True }
|
||||
- name: Remove aptitude if not originally present
|
||||
apt:
|
||||
pkg: aptitude
|
||||
state: absent
|
||||
when:
|
||||
- aptitude_status.stdout.find('ii') == -1
|
||||
|
||||
- name: Remove aptitude if not originally present
|
||||
apt:
|
||||
pkg: aptitude
|
||||
state: absent
|
||||
when:
|
||||
- aptitude_status.stdout.find('ii') == -1
|
||||
when:
|
||||
- ansible_distribution in ('Ubuntu', 'Debian')
|
||||
|
|
|
@ -7,41 +7,35 @@
|
|||
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, force_apt_get: {{force_apt_get|default(False)}}"
|
||||
- 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 | default(False) }}"
|
||||
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
|
||||
|
||||
- debug: var=upgrade_result.warnings|default([])
|
||||
- debug: var=aptitude_present
|
||||
- debug: var=force_apt_get
|
||||
|
||||
- name: check that warning is not given when force_apt_get set
|
||||
assert:
|
||||
that:
|
||||
- "'Could not find aptitude. Using apt-get instead' not in upgrade_result.warnings | default([])"
|
||||
- "'warnings' not in upgrade_result"
|
||||
when:
|
||||
- force_apt_get | default(False)
|
||||
- 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"
|
||||
- "'Could not find aptitude. Using apt-get instead' in upgrade_result.warnings[0]"
|
||||
when:
|
||||
- not aptitude_present|default(True)
|
||||
- not force_apt_get|default(False)
|
||||
- not aptitude_present
|
||||
- not force_apt_get
|
||||
|
||||
- name: check that old version upgraded correctly
|
||||
assert:
|
||||
|
@ -52,7 +46,7 @@
|
|||
- name: "(upgrade type: {{upgrade_type}}) upgrade packages to latest version (Idempotant)"
|
||||
apt:
|
||||
upgrade: "{{ upgrade_type }}"
|
||||
force_apt_get: "{{ force_apt_get | default(False) }}"
|
||||
force_apt_get: "{{ force_apt_get }}"
|
||||
register: second_upgrade_result
|
||||
|
||||
- name: check that nothing has changed (Idempotant)
|
||||
|
|
Loading…
Reference in a new issue