mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
added integration tests for dpkg_selections (#26043)
This commit is contained in:
parent
3102746ebe
commit
9500aac5b9
4 changed files with 92 additions and 0 deletions
2
test/integration/targets/dpkg_selections/aliases
Normal file
2
test/integration/targets/dpkg_selections/aliases
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
posix/ci/group1
|
||||||
|
destructive
|
|
@ -0,0 +1 @@
|
||||||
|
hello_old_version: 2.6-1
|
|
@ -0,0 +1,86 @@
|
||||||
|
- name: download and install old version of hello
|
||||||
|
apt: "deb=https://launchpad.net/ubuntu/+archive/primary/+files/hello_{{ hello_old_version }}_amd64.deb"
|
||||||
|
|
||||||
|
- name: freeze version for hello
|
||||||
|
dpkg_selections:
|
||||||
|
name: hello
|
||||||
|
selection: hold
|
||||||
|
|
||||||
|
- name: get dpkg selections
|
||||||
|
shell: "dpkg --get-selections | grep hold"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug: var=result
|
||||||
|
|
||||||
|
- name: check that hello is marked as hold
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "'hello' in result.stdout"
|
||||||
|
|
||||||
|
- name: attempt to upgrade hello
|
||||||
|
apt:
|
||||||
|
upgrade: dist
|
||||||
|
|
||||||
|
- name: check hello version
|
||||||
|
shell: dpkg -s hello | grep Version | awk '{print $2}'
|
||||||
|
register: hello_version
|
||||||
|
|
||||||
|
- name: ensure hello was not upgraded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "{{ hello_version.stdout }} == {{ hello_old_version }}"
|
||||||
|
|
||||||
|
- name: remove version freeze
|
||||||
|
dpkg_selections:
|
||||||
|
name: hello
|
||||||
|
selection: install
|
||||||
|
|
||||||
|
- name: upgrade hello
|
||||||
|
apt:
|
||||||
|
upgrade: dist
|
||||||
|
|
||||||
|
- 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 }}"
|
||||||
|
|
||||||
|
- name: set hello to deinstall
|
||||||
|
dpkg_selections:
|
||||||
|
name: hello
|
||||||
|
selection: deinstall
|
||||||
|
|
||||||
|
- name: get dpkg selections
|
||||||
|
shell: "dpkg --get-selections | grep deinstall"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug: var=result
|
||||||
|
|
||||||
|
- name: check that hello is marked as deinstall
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "'hello' in result.stdout"
|
||||||
|
|
||||||
|
- name: set hello to purge
|
||||||
|
dpkg_selections:
|
||||||
|
name: hello
|
||||||
|
selection: purge
|
||||||
|
|
||||||
|
- name: get dpkg selections
|
||||||
|
shell: "dpkg --get-selections | grep purge"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- debug: var=result
|
||||||
|
|
||||||
|
- name: check that hello is marked as purge
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "'hello' in result.stdout"
|
||||||
|
|
||||||
|
- name: remove hello
|
||||||
|
apt:
|
||||||
|
name: hello
|
||||||
|
state: absent
|
3
test/integration/targets/dpkg_selections/tasks/main.yaml
Normal file
3
test/integration/targets/dpkg_selections/tasks/main.yaml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
- include: 'dpkg_selections.yaml'
|
||||||
|
when: ansible_distribution in ('Ubuntu', 'Debian')
|
Loading…
Reference in a new issue