diff --git a/test/integration/targets/win_nssm/aliases b/test/integration/targets/win_nssm/aliases new file mode 100644 index 00000000000..215e0b06920 --- /dev/null +++ b/test/integration/targets/win_nssm/aliases @@ -0,0 +1 @@ +shippable/windows/group4 diff --git a/test/integration/targets/win_nssm/defaults/main.yml b/test/integration/targets/win_nssm/defaults/main.yml new file mode 100644 index 00000000000..1c7900f727d --- /dev/null +++ b/test/integration/targets/win_nssm/defaults/main.yml @@ -0,0 +1 @@ +test_service_name: ansible_nssm_test \ No newline at end of file diff --git a/test/integration/targets/win_nssm/tasks/main.yml b/test/integration/targets/win_nssm/tasks/main.yml new file mode 100644 index 00000000000..9b3769e645e --- /dev/null +++ b/test/integration/targets/win_nssm/tasks/main.yml @@ -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 diff --git a/test/integration/targets/win_nssm/tasks/tests.yml b/test/integration/targets/win_nssm/tasks/tests.yml new file mode 100644 index 00000000000..d70e83320c1 --- /dev/null +++ b/test/integration/targets/win_nssm/tasks/tests.yml @@ -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" \ No newline at end of file