win_nssm: add failing tests for issue #44079

(cherry picked from commit a5d1241fa1)
pull/46479/merge
Kévin Subileau 6 years ago committed by Toshio Kuratomi
parent 8b0c46a51a
commit 14cccb9488

@ -0,0 +1 @@
shippable/windows/group4

@ -0,0 +1 @@
test_service_name: ansible_nssm_test

@ -0,0 +1,21 @@
---
- name: install NSSM
win_chocolatey:
name: NSSM
state: present
# Run actual tests
- block:
- include_tasks: tests.yml
always:
- name: ensure test service is absent
win_service:
name: '{{ test_service_name }}'
state: absent
- name: uninstall NSSM
win_chocolatey:
name: NSSM
state: absent
failed_when: false

@ -0,0 +1,21 @@
---
- name: install service
win_nssm:
name: '{{ test_service_name }}'
application: 'C:\Windows\System32\cmd.exe'
app_parameters_free_form: '-Dcom.test.string=value'
state: present
register: install_service
- name: get result of install service
win_shell: |
Write-Host ([bool](Get-Service "{{ test_service_name }}" -ErrorAction SilentlyContinue))
nssm get "{{ test_service_name }}" AppParameters
register: install_service_actual
- name: assert results of install service
assert:
that:
- install_service.changed == true
- install_service_actual.stdout_lines[0] == "True"
- install_service_actual.stdout_lines[1] == "-Dcom.test.string=value"
Loading…
Cancel
Save