diff --git a/tests_new/integration/destructive.yml b/tests_new/integration/destructive.yml index cb455b6fa7..8d0b11c6ac 100644 --- a/tests_new/integration/destructive.yml +++ b/tests_new/integration/destructive.yml @@ -5,4 +5,5 @@ - { role: test_pip, tags: test_pip } - { role: test_gem, tags: test_gem } - { role: test_yum, tags: test_yum } + - { role: test_apt, tags: test_apt } diff --git a/tests_new/integration/roles/test_apt/meta/main.yml b/tests_new/integration/roles/test_apt/meta/main.yml new file mode 100644 index 0000000000..07faa21776 --- /dev/null +++ b/tests_new/integration/roles/test_apt/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - prepare_tests diff --git a/tests_new/integration/roles/test_apt/tasks/apt.yml b/tests_new/integration/roles/test_apt/tasks/apt.yml new file mode 100644 index 0000000000..85e002e101 --- /dev/null +++ b/tests_new/integration/roles/test_apt/tasks/apt.yml @@ -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" diff --git a/tests_new/integration/roles/test_apt/tasks/main.yml b/tests_new/integration/roles/test_apt/tasks/main.yml new file mode 100644 index 0000000000..4f2215f57a --- /dev/null +++ b/tests_new/integration/roles/test_apt/tasks/main.yml @@ -0,0 +1,21 @@ +# test code for the yum module +# (c) 2014, James Tanner + +# 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 . + +- include: 'apt.yml' + when: ansible_distribution in ('Ubuntu', 'Debian') +