mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-27 18:50:21 -07:00
Add apt test role
This commit is contained in:
parent
50e5d81777
commit
2b3856f1b6
4 changed files with 71 additions and 0 deletions
|
@ -5,4 +5,5 @@
|
||||||
- { role: test_pip, tags: test_pip }
|
- { role: test_pip, tags: test_pip }
|
||||||
- { role: test_gem, tags: test_gem }
|
- { role: test_gem, tags: test_gem }
|
||||||
- { role: test_yum, tags: test_yum }
|
- { role: test_yum, tags: test_yum }
|
||||||
|
- { role: test_apt, tags: test_apt }
|
||||||
|
|
||||||
|
|
2
tests_new/integration/roles/test_apt/meta/main.yml
Normal file
2
tests_new/integration/roles/test_apt/meta/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
dependencies:
|
||||||
|
- prepare_tests
|
47
tests_new/integration/roles/test_apt/tasks/apt.yml
Normal file
47
tests_new/integration/roles/test_apt/tasks/apt.yml
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
# UNINSTALL
|
||||||
|
- name: uninstall wget with apt
|
||||||
|
apt: pkg=wget state=absent purge=yes
|
||||||
|
register: apt_result
|
||||||
|
|
||||||
|
- name: check wget with dpkg
|
||||||
|
shell: dpkg --get-selections | fgrep wget
|
||||||
|
failed_when: False
|
||||||
|
register: dpkg_result
|
||||||
|
|
||||||
|
- debug: var=apt_result
|
||||||
|
- debug: var=dpkg_result
|
||||||
|
|
||||||
|
- name: verify uninstallation of wget
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "'changed' in apt_result"
|
||||||
|
- "dpkg_result.rc == 1"
|
||||||
|
|
||||||
|
# INSTALL
|
||||||
|
- name: install wget with apt
|
||||||
|
apt: name=wget state=present
|
||||||
|
register: apt_result
|
||||||
|
|
||||||
|
- name: check wget with dpkg
|
||||||
|
shell: dpkg --get-selections | fgrep wget
|
||||||
|
failed_when: False
|
||||||
|
register: dpkg_result
|
||||||
|
|
||||||
|
- debug: var=apt_result
|
||||||
|
- debug: var=dpkg_result
|
||||||
|
|
||||||
|
- name: verify installation of wget
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "apt_result.changed"
|
||||||
|
- "dpkg_result.rc == 0"
|
||||||
|
|
||||||
|
- name: verify apt module outputs
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "'invocation' in apt_result"
|
||||||
|
- "'changed' in apt_result"
|
||||||
|
- "'item' in apt_result"
|
||||||
|
- "'stderr' in apt_result"
|
||||||
|
- "'stdout' in apt_result"
|
||||||
|
- "'stdout_lines' in apt_result"
|
21
tests_new/integration/roles/test_apt/tasks/main.yml
Normal file
21
tests_new/integration/roles/test_apt/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: 'apt.yml'
|
||||||
|
when: ansible_distribution in ('Ubuntu', 'Debian')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue