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:
René Moser 2017-08-24 15:09:11 +02:00 committed by Martin Krizek
parent 203d8d2e6e
commit 6fc8899290

View file

@ -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