1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

add very basic tests of win_package, based on existing win_msi tests. (#17383)

* add very basic tests of win_package, based on existing win_msi tests.
This commit is contained in:
jhawkesworth 2016-09-06 07:09:32 +01:00 committed by John R Barker
parent 7a0b25d5fa
commit 9fe4308670
3 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1,6 @@
---
msi_url: https://ansible-ci-files.s3.amazonaws.com/test/integration/roles/test_win_msi/7z922-x64.msi
msi_download_path: "C:\\Program Files\\7z922-x64.msi"
msi_install_path: "C:\\Program Files\\7-Zip"
msi_product_code: "{23170F69-40C1-2702-0922-000001000000}"

View file

@ -0,0 +1,81 @@
# test code for the win_package module
# (c) 2014, Chris Church <chris@ninemoreminutes.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/>.
- name: use win_get_url module to download msi
win_get_url:
url: "{{msi_url}}"
dest: "{{msi_download_path}}"
register: win_get_url_result
- name: make sure msi is uninstalled
win_package:
path: "{{msi_download_path}}"
product_id: "{{msi_product_code}}"
state: absent
- name: install msi
win_package:
path: "{{msi_download_path}}"
product_id: "{{msi_product_code}}"
state: present
register: win_package_install_result
- name: check win_package install result
assert:
that:
- "not win_package_install_result|failed"
- "win_package_install_result|changed"
- name: install msi again (check for no change)
win_package:
path: "{{msi_download_path}}"
product_id: "{{msi_product_code}}"
state: present
register: win_package_install_again_result
- name: check win_package install again result
assert:
that:
- "not win_package_install_again_result|failed"
- "not win_package_install_again_result|changed"
- name: uninstall msi
win_package:
path: "{{msi_download_path}}"
product_id: "{{msi_product_code}}"
state: absent
register: win_package_uninstall_result
- name: check win_package uninstall result
assert:
that:
- "not win_package_uninstall_result|failed"
- "win_package_uninstall_result|changed"
- name: uninstall msi again (check for no change)
win_package:
path: "{{msi_download_path}}"
product_id: "{{msi_product_code}}"
state: absent
register: win_package_uninstall_again_result
- name: check win_package uninstall result
assert:
that:
- "not win_package_uninstall_result|failed"
- "not win_package_uninstall_again_result|changed"

View file

@ -9,3 +9,4 @@
- { role: test_win_stat, tags: test_win_stat }
- { role: test_win_get_url, tags: test_win_get_url }
- { role: test_win_msi, tags: test_win_msi }
- { role: test_win_package, tags: test_win_package }