mirror of https://github.com/ansible/ansible.git
Add yum tests
parent
021ae05f33
commit
57fc86ec3c
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- prepare_tests
|
||||
@ -0,0 +1,21 @@
|
||||
# test code for the yum module
|
||||
# (c) 2014, James Tanner <tanner.jc@gmail.com>
|
||||
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- include: 'yum.yml'
|
||||
when: ansible_distribution in ('RHEL', 'CentOS', 'ScientificLinux', 'Fedora')
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
# UNINSTALL
|
||||
- name: uninstall sos
|
||||
yum: name=sos state=removed
|
||||
register: yum_result
|
||||
|
||||
- name: check sos with rpm
|
||||
shell: rpm -q sos
|
||||
failed_when: False
|
||||
register: rpm_result
|
||||
|
||||
- debug: var=yum_result
|
||||
- debug: var=rpm_result
|
||||
|
||||
- name: verify uninstalltion of sos
|
||||
assert:
|
||||
that:
|
||||
- "yum_result.rc == 0"
|
||||
- "rpm_result.rc == 1"
|
||||
|
||||
# INSTALL
|
||||
- name: install sos
|
||||
yum: name=sos state=present
|
||||
register: yum_result
|
||||
|
||||
- name: check sos with rpm
|
||||
shell: rpm -q sos
|
||||
failed_when: False
|
||||
register: rpm_result
|
||||
|
||||
- debug: var=yum_result
|
||||
- debug: var=rpm_result
|
||||
|
||||
- name: verify installation of sos
|
||||
assert:
|
||||
that:
|
||||
- "yum_result.rc == 0"
|
||||
- "yum_result.changed"
|
||||
- "rpm_result.rc == 0"
|
||||
|
||||
- name: verify yum module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'invocation' in yum_result"
|
||||
- "'changed' in yum_result"
|
||||
- "'item' in yum_result"
|
||||
- "'msg' in yum_result"
|
||||
- "'rc' in yum_result"
|
||||
- "'results' in yum_result"
|
||||
|
||||
Loading…
Reference in New Issue