summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjhawkesworth <jhawkesworth@users.noreply.github.com>2016-09-06 07:09:32 +0100
committerJohn R Barker <john@johnrbarker.com>2016-09-06 07:09:32 +0100
commit9fe430867063a0a63316e9bb71e9ba03a475a989 (patch)
tree199c755a79d3654490ffb3f04b5c1932238b5ed6
parent7a0b25d5fa9762ec515258caefe8c70b2575c522 (diff)
downloadansible-9fe430867063a0a63316e9bb71e9ba03a475a989.tar.gz
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.
-rw-r--r--test/integration/roles/test_win_package/defaults/main.yml6
-rw-r--r--test/integration/roles/test_win_package/tasks/main.yml81
-rw-r--r--test/integration/test_win_group2.yml1
3 files changed, 88 insertions, 0 deletions
diff --git a/test/integration/roles/test_win_package/defaults/main.yml b/test/integration/roles/test_win_package/defaults/main.yml
new file mode 100644
index 0000000000..ebc97b84cc
--- /dev/null
+++ b/test/integration/roles/test_win_package/defaults/main.yml
@@ -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}"
diff --git a/test/integration/roles/test_win_package/tasks/main.yml b/test/integration/roles/test_win_package/tasks/main.yml
new file mode 100644
index 0000000000..3df394fc75
--- /dev/null
+++ b/test/integration/roles/test_win_package/tasks/main.yml
@@ -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"
diff --git a/test/integration/test_win_group2.yml b/test/integration/test_win_group2.yml
index 17bbee0a7d..c276e9c1e7 100644
--- a/test/integration/test_win_group2.yml
+++ b/test/integration/test_win_group2.yml
@@ -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 }