mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add yum tests
This commit is contained in:
parent
021ae05f33
commit
57fc86ec3c
5 changed files with 74 additions and 1 deletions
|
@ -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 }
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
2
tests_new/integration/roles/test_yum/meta/main.yml
Normal file
2
tests_new/integration/roles/test_yum/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- prepare_tests
|
21
tests_new/integration/roles/test_yum/tasks/main.yml
Normal file
21
tests_new/integration/roles/test_yum/tasks/main.yml
Normal 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')
|
||||
|
49
tests_new/integration/roles/test_yum/tasks/yum.yml
Normal file
49
tests_new/integration/roles/test_yum/tasks/yum.yml
Normal 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"
|
||||
|
Loading…
Reference in a new issue