mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
test: yum: add test cases for state=latest (#28575)
* test: yum: add test with state=latest * test: yum: extend test cases with check mode
This commit is contained in:
parent
203d8d2e6e
commit
6fc8899290
1 changed files with 82 additions and 2 deletions
|
@ -15,6 +15,16 @@
|
|||
- "rpm_result.rc == 1"
|
||||
|
||||
# UNINSTALL AGAIN
|
||||
- name: uninstall sos again in check mode
|
||||
yum: name=sos state=removed
|
||||
check_mode: true
|
||||
register: yum_result
|
||||
|
||||
- name: verify no change on re-uninstall in check mdoe
|
||||
assert:
|
||||
that:
|
||||
- "not yum_result.changed"
|
||||
|
||||
- name: uninstall sos again
|
||||
yum: name=sos state=removed
|
||||
register: yum_result
|
||||
|
@ -25,6 +35,16 @@
|
|||
- "not yum_result.changed"
|
||||
|
||||
# INSTALL
|
||||
- name: install sos in check mode
|
||||
yum: name=sos state=present
|
||||
check_mode: true
|
||||
register: yum_result
|
||||
|
||||
- name: verify installation of sos in check mode
|
||||
assert:
|
||||
that:
|
||||
- "yum_result.changed"
|
||||
|
||||
- name: install sos
|
||||
yum: name=sos state=present
|
||||
register: yum_result
|
||||
|
@ -50,15 +70,75 @@
|
|||
- "'results' in yum_result"
|
||||
|
||||
# INSTALL AGAIN
|
||||
- name: install sos again in check mode
|
||||
yum: name=sos state=present
|
||||
check_mode: true
|
||||
register: yum_result
|
||||
- name: verify no change on second install in check mode
|
||||
assert:
|
||||
that:
|
||||
- "not yum_result.changed"
|
||||
|
||||
- name: install sos again
|
||||
yum: name=sos state=present
|
||||
register: yum_result
|
||||
|
||||
- name: verify no change on second install
|
||||
assert:
|
||||
that:
|
||||
- "not yum_result.changed"
|
||||
|
||||
# INSTALL AGAIN WITH LATEST
|
||||
- name: install sos again with state latest in check mode
|
||||
yum: name=sos state=latest
|
||||
check_mode: true
|
||||
register: yum_result
|
||||
- name: verify install sos again with state latest in check mode
|
||||
assert:
|
||||
that:
|
||||
- "not yum_result.changed"
|
||||
|
||||
- name: install sos again with state latest idempotence
|
||||
yum: name=sos state=latest
|
||||
register: yum_result
|
||||
- name: verify install sos again with state latest idempotence
|
||||
assert:
|
||||
that:
|
||||
- "not yum_result.changed"
|
||||
|
||||
# INSTALL WITH LATEST
|
||||
- name: uninstall sos
|
||||
yum: name=sos state=removed
|
||||
register: yum_result
|
||||
- name: verify uninstall sos
|
||||
assert:
|
||||
that:
|
||||
- "yum_result|success"
|
||||
|
||||
- name: install sos with state latest in check mode
|
||||
yum: name=sos state=latest
|
||||
check_mode: true
|
||||
register: yum_result
|
||||
- name: verify install sos with state latest in check mode
|
||||
assert:
|
||||
that:
|
||||
- "yum_result.changed"
|
||||
|
||||
- name: install sos with state latest
|
||||
yum: name=sos state=latest
|
||||
register: yum_result
|
||||
- name: verify install sos with state latest
|
||||
assert:
|
||||
that:
|
||||
- "yum_result.changed"
|
||||
|
||||
- name: install sos with state latest idempotence
|
||||
yum: name=sos state=latest
|
||||
register: yum_result
|
||||
- name: verify install sos with state latest idempotence
|
||||
assert:
|
||||
that:
|
||||
- "not yum_result.changed"
|
||||
|
||||
# Multiple packages
|
||||
- name: uninstall sos and bc
|
||||
yum: name=sos,bc state=removed
|
||||
|
|
Loading…
Reference in a new issue