Add yum tests

This commit is contained in:
James Tanner 2014-02-20 13:41:45 -05:00
parent 021ae05f33
commit 57fc86ec3c
5 changed files with 74 additions and 1 deletions

View file

@ -4,4 +4,5 @@
- { role: test_service, tags: test_service }
- { role: test_pip, tags: test_pip }
- { role: test_gem, tags: test_gem }
- { role: test_yum, tags: test_yum }

View file

@ -1,4 +1,4 @@
# test code for the git module
# test code for the hg module
# (c) 2014, James Tanner <tanner.jc@gmail.com>
# This file is part of Ansible

View file

@ -0,0 +1,2 @@
dependencies:
- prepare_tests

View file

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

View file

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