1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/win_package/tasks/failure_tests.yml
Jordan Borean adabefd016 win_package: rewrite, check mode, tests, more check options (#27470)
* rewrite of win_package to enable win_msi deprecation

* fix some minor doc issues

* Removed exe tests

* dag's changes seem to be missing, re-add them

* fixed yaml for return values
2017-08-28 19:03:10 -04:00

82 lines
3.3 KiB
YAML

# these tests are invalid arguments and failure states for win_package
---
- name: fail to install broken msi
win_package:
path: '{{test_win_package_path}}\bad.msi'
state: present
register: fail_bad_rc
failed_when: "'unexpected rc from install' not in fail_bad_rc.msg and fail_bad_rc.exit_code != 1603"
- name: fail when not using an int for a return code
win_package:
path: '{{test_win_package_path}}\good.msi'
state: present
expected_return_code: 0,abc
register: fail_invalid_return_code
failed_when: fail_invalid_return_code.msg != 'failed to parse expected return code abc as an integer'
- name: fail when path is not set and state!= absent
win_package:
state: present
register: fail_no_path
failed_when: fail_no_path.msg != 'path can only be null when state=absent and product_id is not null'
- 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 != 'path can only be null when state=absent and product_id is not null'
- name: fail when product_id is not set and path is not a local MSI
win_package:
path: '{{test_win_package_good_url}}'
state: present
register: fail_install_url_no_id
failed_when: fail_install_url_no_id.msg != 'product_id is required when the path is not an MSI or the path is an MSI but not local'
- name: fail invalid local path
win_package:
path: '{{test_win_package_path}}\no file.msi'
state: present
register: fail_invalid_local_path
failed_when: fail_invalid_local_path.msg != 'the file at the local path ' + test_win_package_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: "fail_invalid_url_path.msg != 'the file at the URL http://fakeurl/file.msi cannot be reached: The remote name could not be resolved: \\'fakeurl\\''"
- name: fail invalid UNC path
win_package:
path: \\fakenetwork\unc file.msi
product_id: 'id'
state: present
register: fail_invalid_unc_path
failed_when: fail_invalid_unc_path.msg != 'the file at the UNC path \\\\fakenetwork\\unc file.msi cannot be reached, ensure the user_name account has access to this path or use an auth transport with credential delegation'
- name: fail when product_id is not set and path is not a local MSI
win_package:
path: '{{test_win_package_good_url}}'
state: present
register: fail_no_id_not_local_msi
failed_when: fail_no_id_not_local_msi.msg != 'product_id is required when the path is not an MSI or the path is an MSI but not local'
- name: fail to check version without creates_path
win_package:
path: '{{test_win_package_path}}\7z.exe'
state: present
creates_version: 1
register: fail_creates_version_without_path
failed_when: fail_creates_version_without_path.msg != 'creates_path must be set when creates_version is set'
- name: fail to check version without when path is not a file
win_package:
path: '{{test_win_package_path}}\7z.exe'
state: present
creates_path: C:\Windows
creates_version: 1
register: fail_creates_version_not_a_file
failed_when: fail_creates_version_not_a_file.msg != 'creates_path must be a file not a directory when creates_version is set'