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_psmodule/tasks/test.yml
Matt Martz 4fe08441be Deprecate tests used as filters (#32361)
* Warn on tests used as filters

* Update docs, add aliases for tests that fit more gramatically with test syntax

* Fix rst formatting

* Add successful filter, alias of success

* Remove renamed_deprecation, it was overkill

* Make directory alias for is_dir

* Update tests to use proper jinja test syntax

* Update additional documentation, living outside of YAML files, to reflect proper jinja test syntax

* Add conversion script, porting guide updates, and changelog updates

* Update newly added uses of tests as filters

* No underscore variable

* Convert recent tests as filter changes to win_stat

* Fix some changes related to rebasing a few integration tests

* Make tests_as_filters_warning explicitly accept the name of the test, instead of inferring the name

* Add test for tests_as_filters_warning

* Update tests as filters in newly added/modified tests

* Address recent changes to several integration tests

* Address recent changes in cs_vpc
2017-11-27 17:58:08 -05:00

136 lines
No EOL
3.3 KiB
YAML

---
- name: install module from Powershell Gallery
win_psmodule:
name: "{{ powershell_module }}"
state: present
register: module_setup
- name: test Powershell Gallery module setup
assert:
that:
- "module_setup is changed"
- "module_setup.output == 'Module {{ powershell_module }} installed'"
- name: check idempotency reinstalling module
win_psmodule:
name: "{{ powershell_module }}"
state: present
register: module_reinstall
- name: test win_psmodule idempotency
assert:
that:
- "module_reinstall is not changed"
- name: check module install with allow_clobber not active
win_psmodule:
name: "{{ allow_clobber_module }}"
register: fail_allow_clobber
ignore_errors: yes
- name: test allow_clobber has failed
assert:
that:
- "fail_allow_clobber is failed"
- name: check module install with allow_clobber active
win_psmodule:
name: "{{ allow_clobber_module }}"
allow_clobber: yes
register: ok_allow_clobber
- name: test module install with allow_clobber active
assert:
that:
- "ok_allow_clobber is changed"
- name: check wrong module install attempt
win_psmodule:
name: "{{ wrong_module }}"
state: present
ignore_errors: yes
register: module_fail
- name: test module setup fails
assert:
that:
- "module_fail is failed"
- name: check fake custom ps repository registration attempt
win_psmodule:
name: "{{ wrong_module }}"
repository: Fake repository
url: http://my_fake_repo.com/repo/
ignore_errors: yes
register: repo_fail
- name: test fake custom ps repository registration attempt
assert:
that:
- "repo_fail is failed"
- name: check module is installed
win_shell: (Get-Module -Name {{ powershell_module }} -ListAvailable).Name
register: module_check
- name: test module is installed
assert:
that:
- "module_check.stdout_lines[0] == '{{ powershell_module }}'"
- name: check allow_clobber module is installed
win_shell: (Get-Module -Name {{ allow_clobber_module }} -ListAvailable).Name
register: allow_clobber_check
- name: test allow_clobber module is installed
assert:
that:
- "allow_clobber_check.stdout_lines[0] == '{{ allow_clobber_module }}'"
- name: remove installed powershell module
win_psmodule:
name: powershell-yaml
state: absent
register: module_uninstall
- name: test powershell module removal
assert:
that:
- "module_uninstall is changed"
- "module_uninstall.output == 'Module {{ powershell_module }} removed'"
- name: check module is uninstalled
win_shell: (Get-Module -Name {{ powershell_module }} -ListAvailable).Name
register: module_check
- name: test module is no more present
assert:
that:
- "module_check.stdout == ''"
- name: check idempotency re-removing module
win_psmodule:
name: "{{ powershell_module }}"
state: absent
register: module_uninstall_2
- name: test idempotency
assert:
that:
- "module_uninstall_2 is not changed"
- name: check removing allow_clobber module
win_psmodule:
name: "{{ allow_clobber_module }}"
state: absent
register: module_uninstall_3
- name: test removing allow_clobber module
assert:
that:
- "module_uninstall_2 is not changed"
- "module_uninstall_3 is changed"