ansible/test/integration/targets/win_nssm/tasks/main.yml
Kevin Subileau ac9d506a61 win_nssm: tests and several bug fixes (#44755)
* win_nssm: add failing tests for issue #44079

* win_nssm: use Run-Command instead of Invoke-Expression to prevent interpretation issue

Fix #44079

* win_nssm: add more failing tests

These tests highlight several issues with this module:
 * Service not started when state=started
 * Errors with app_parameters (see #25265)
 * Exception when passing several dependencies separated by comma as specified in doc

* win_nssm: fix service not started when state=started

Nssm status returns a multiline output that doesn't match any of the strict patterns in the switch statement.

* win_nssm: fix incorrect separator in doc for service dependencies

The dependencies parameter works with space as separator, but not with comma as shown in the documentation

* win_nssm: fix error with app_parameters parameter

Fix #25265

* win_nssm: add idempotence tests

* win_nssm: fix several idempotence issues and misbehaviors

Add missing space between arguments when app_parameters contains several keys.
Use Argv-ToString and Escape-Argument to improve arguments handling (parameters with quotes, backslashes or spaces).

* win_nssm: test parameters with spaces, quotes or backslashes

* win_nssm: restore comma as separator for service dependencies

Revert commit ddd4b4b

* win_nssm: restore support of string as dict form for app_parameters and remove support of literal YAML dict

* win_nssm: wrong variable in tests
2018-09-27 13:15:04 +10:00

44 lines
897 B
YAML

---
- name: install NSSM
win_chocolatey:
name: NSSM
state: present
- name: ensure testing folder exists
win_file:
path: '{{test_win_nssm_path}}'
state: directory
- name: create test user for service execution
win_user:
name: '{{test_win_nssm_username}}'
password: '{{test_win_nssm_password}}'
state: present
groups:
- Users
# Run actual tests
- block:
- include_tasks: tests.yml
always:
- name: ensure test service is absent
win_service:
name: '{{ test_service_name }}'
state: absent
- name: remove test user
win_user:
name: '{{test_win_nssm_username}}'
state: absent
- name: cleanup test folder
win_file:
path: '{{test_win_nssm_path}}'
state: absent
- name: uninstall NSSM
win_chocolatey:
name: NSSM
state: absent
failed_when: false