ansible/test/integration/targets/win_package/tasks/failure_tests.yml
Jordan Borean 446a0c1b08
win_package - Refactor with msp, appx support (#66931)
* win_package - Refactor with msp, appx support

* Added msi test for ALLUSERS

* Added some msix tests, refactored tests

* Added remaining msix tests

* Enable msix sideloading for tests

* Added remaining exe path tests

* Added basic msp tests

* Remove url options now the util no longer has them

* Fix file version check for older Windows hosts

* Remove no_proxy ansible-test setting

* Use same mechanism of become to copy the file with explicit creds
2020-02-13 16:44:19 +10:00

60 lines
2.3 KiB
YAML

# these tests are invalid arguments and failure states for win_package
---
- name: fail to install broken msi
win_package:
path: '{{ test_path }}\bad.msi'
state: present
register: fail_bad_rc
failed_when: "'unexpected rc from' not in fail_bad_rc.msg and fail_bad_rc.rc != 1603"
- name: fail when not using an int for a return code
win_package:
path: '{{ test_path }}\good.msi'
state: present
expected_return_code: 0,abc
register: fail_invalid_return_code
failed_when: "'argument for list entry expected_return_code is of type System>String and we were unable to convert to in' in fail_invalid_return_code.msg"
- name: fail when path is not set and state!= absent
win_package:
state: present
register: fail_no_path
failed_when: 'fail_no_path.msg != "state is present but all of the following are missing: path"'
- name: fail when path is not set and state=absent but product_id is null
win_package:
state: absent
register: fail_no_path_state_absent_no_id
failed_when: 'fail_no_path_state_absent_no_id.msg != "state is absent but any of the following are missing: path, product_id"'
- name: fail invalid local path
win_package:
path: '{{ test_path }}\no file.msi'
state: present
register: fail_invalid_local_path
failed_when: fail_invalid_local_path.msg != "the file at the path '" + test_path + "\\no file.msi' cannot be reached"
- name: fail invalid URL
win_package:
path: http://fakeurl/file.msi
product_id: 'id'
state: present
register: fail_invalid_url_path
failed_when: "\"The remote name could not be resolved: 'fakeurl'\" not in fail_invalid_url_path.msg"
- name: fail to check version without creates_path
win_package:
path: '{{ test_path }}\good.msi'
state: present
creates_version: 1
register: fail_creates_version_without_path
failed_when: "fail_creates_version_without_path.msg != \"missing parameter(s) required by 'creates_version': creates_path\""
- name: fail to check version without when path is not a file
win_package:
path: '{{ test_path }}\good.msi'
state: present
creates_path: C:\Windows
creates_version: 1
register: fail_creates_version_not_a_file
failed_when: "'creates_path must be a file not a directory when creates_version is set' not in fail_creates_version_not_a_file.msg"