mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
dnf: add integration tests (based on yum tests) (#28881)
This commit is contained in:
parent
d733f5af06
commit
503bfaf38b
1 changed files with 111 additions and 0 deletions
|
@ -264,6 +264,60 @@
|
|||
- "'changed' in dnf_result"
|
||||
- "'results' in dnf_result"
|
||||
|
||||
- name: install the group again
|
||||
dnf:
|
||||
name: "@Books and Guides"
|
||||
state: present
|
||||
register: dnf_result
|
||||
|
||||
- name: verify nothing changed
|
||||
assert:
|
||||
that:
|
||||
- "not dnf_result.changed"
|
||||
|
||||
- name: verify dnf module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in dnf_result"
|
||||
- "'msg' in dnf_result"
|
||||
|
||||
- name: install the group again but also with a package that is not yet installed
|
||||
dnf:
|
||||
name:
|
||||
- "@Books and Guides"
|
||||
- bc
|
||||
state: present
|
||||
register: dnf_result
|
||||
|
||||
- name: verify bc is installed
|
||||
assert:
|
||||
that:
|
||||
- "dnf_result.changed"
|
||||
|
||||
- name: verify dnf module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in dnf_result"
|
||||
- "'results' in dnf_result"
|
||||
|
||||
- name: try to install the group again, with --check to check 'changed'
|
||||
dnf:
|
||||
name: "@Books and Guides"
|
||||
state: present
|
||||
check_mode: yes
|
||||
register: dnf_result
|
||||
|
||||
- name: verify nothing changed
|
||||
assert:
|
||||
that:
|
||||
- "not dnf_result.changed"
|
||||
|
||||
- name: verify dnf module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in dnf_result"
|
||||
- "'msg' in dnf_result"
|
||||
|
||||
# cleanup until https://github.com/ansible/ansible/issues/27377 is resolved
|
||||
- shell: dnf -y group install "Books and Guides" && dnf -y group remove "Books and Guides"
|
||||
|
||||
|
@ -292,3 +346,60 @@
|
|||
|
||||
# cleanup until https://github.com/ansible/ansible/issues/27377 is resolved
|
||||
- shell: dnf -y group install "Books and Guides" && dnf -y group remove "Books and Guides"
|
||||
|
||||
- name: try to install non existing group
|
||||
dnf:
|
||||
name: "@non-existing-group"
|
||||
state: present
|
||||
register: dnf_result
|
||||
ignore_errors: True
|
||||
|
||||
- name: verify installation of the non existing group failed
|
||||
assert:
|
||||
that:
|
||||
- "not dnf_result.changed"
|
||||
- "dnf_result|failed"
|
||||
|
||||
- name: verify dnf module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in dnf_result"
|
||||
- "'msg' in dnf_result"
|
||||
|
||||
- name: try to install non existing file
|
||||
dnf:
|
||||
name: /tmp/non-existing-1.0.0.fc26.noarch.rpm
|
||||
state: present
|
||||
register: dnf_result
|
||||
ignore_errors: yes
|
||||
|
||||
- name: verify installation failed
|
||||
assert:
|
||||
that:
|
||||
- "dnf_result|failed"
|
||||
- "not dnf_result.changed"
|
||||
|
||||
- name: verify dnf module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in dnf_result"
|
||||
- "'msg' in dnf_result"
|
||||
|
||||
- name: try to install from non existing url
|
||||
dnf:
|
||||
name: http://non-existing.com/non-existing-1.0.0.fc26.noarch.rpm
|
||||
state: present
|
||||
register: dnf_result
|
||||
ignore_errors: yes
|
||||
|
||||
- name: verify installation failed
|
||||
assert:
|
||||
that:
|
||||
- "dnf_result|failed"
|
||||
- "not dnf_result.changed"
|
||||
|
||||
- name: verify dnf module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'changed' in dnf_result"
|
||||
- "'msg' in dnf_result"
|
||||
|
|
Loading…
Reference in a new issue