diff options
Diffstat (limited to 'test/integration/targets/connection_winrm')
4 files changed, 66 insertions, 0 deletions
diff --git a/test/integration/targets/connection_winrm/aliases b/test/integration/targets/connection_winrm/aliases new file mode 100644 index 0000000..af3f193 --- /dev/null +++ b/test/integration/targets/connection_winrm/aliases @@ -0,0 +1,5 @@ +windows +shippable/windows/group1 +shippable/windows/smoketest +needs/target/connection +needs/target/setup_remote_tmp_dir diff --git a/test/integration/targets/connection_winrm/runme.sh b/test/integration/targets/connection_winrm/runme.sh new file mode 100755 index 0000000..36a7aa8 --- /dev/null +++ b/test/integration/targets/connection_winrm/runme.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -eux + +# make sure hosts are using winrm connections +ansible -i ../../inventory.winrm localhost \ + -m template \ + -a "src=test_connection.inventory.j2 dest=${OUTPUT_DIR}/test_connection.inventory" \ + "$@" + +cd ../connection + +INVENTORY="${OUTPUT_DIR}/test_connection.inventory" ./test.sh \ + -e target_hosts=windows \ + -e action_prefix=win_ \ + -e local_tmp=/tmp/ansible-local \ + -e remote_tmp=c:/windows/temp/ansible-remote \ + "$@" + +cd ../connection_winrm + +ansible-playbook -i "${OUTPUT_DIR}/test_connection.inventory" tests.yml \ + "$@" diff --git a/test/integration/targets/connection_winrm/test_connection.inventory.j2 b/test/integration/targets/connection_winrm/test_connection.inventory.j2 new file mode 100644 index 0000000..7c4f3dc --- /dev/null +++ b/test/integration/targets/connection_winrm/test_connection.inventory.j2 @@ -0,0 +1,10 @@ +[windows] +{% for host in vars.groups.windows %} +{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_port={{ hostvars[host]['ansible_port'] }} ansible_user={{ hostvars[host]['ansible_user'] }} ansible_password={{ hostvars[host]['ansible_password'] }} +{% endfor %} + +[windows:vars] +ansible_connection=winrm +# we don't know if we're using an encrypted connection or not, so we'll use message encryption +ansible_winrm_transport=ntlm +ansible_winrm_server_cert_validation=ignore diff --git a/test/integration/targets/connection_winrm/tests.yml b/test/integration/targets/connection_winrm/tests.yml new file mode 100644 index 0000000..78f92a4 --- /dev/null +++ b/test/integration/targets/connection_winrm/tests.yml @@ -0,0 +1,28 @@ +--- +- name: test out Windows WinRM specific tests + hosts: windows + force_handlers: yes + serial: 1 + gather_facts: no + + tasks: + - name: setup remote tmp dir + import_role: + name: ../../setup_remote_tmp_dir + + - name: copy across empty file + win_copy: + content: '' + dest: '{{ remote_tmp_dir }}\empty.txt' + register: winrm_copy_empty + + - name: get result of copy across empty file + win_stat: + path: '{{ remote_tmp_dir }}\empty.txt' + register: winrm_copy_empty_actual + + - name: assert copy across empty file + assert: + that: + - winrm_copy_empty is changed + - winrm_copy_empty_actual.stat.size == 0 |