win_nssm: add failing tests for issue #44079
(cherry picked from commit a5d1241fa1
)
This commit is contained in:
parent
8b0c46a51a
commit
14cccb9488
4 changed files with 44 additions and 0 deletions
1
test/integration/targets/win_nssm/aliases
Normal file
1
test/integration/targets/win_nssm/aliases
Normal file
|
@ -0,0 +1 @@
|
||||||
|
shippable/windows/group4
|
1
test/integration/targets/win_nssm/defaults/main.yml
Normal file
1
test/integration/targets/win_nssm/defaults/main.yml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
test_service_name: ansible_nssm_test
|
21
test/integration/targets/win_nssm/tasks/main.yml
Normal file
21
test/integration/targets/win_nssm/tasks/main.yml
Normal file
|
@ -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
|
21
test/integration/targets/win_nssm/tasks/tests.yml
Normal file
21
test/integration/targets/win_nssm/tasks/tests.yml
Normal file
|
@ -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…
Reference in a new issue