From ff4f4bc8a03146704a72ec95bf0a309301529988 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 2 Aug 2016 10:42:07 -0700 Subject: [PATCH] Add binary module tests to Windows CI. (#16914) --- test/integration/Makefile | 5 ++++- test/integration/download_binary_modules.yml | 19 +++++++++++++++---- test/integration/inventory | 2 ++ test/integration/inventory.winrm.template | 7 ++++--- test/integration/test_binary_modules.yml | 2 +- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/test/integration/Makefile b/test/integration/Makefile index ea02b39338b..ee8be66d685 100644 --- a/test/integration/Makefile +++ b/test/integration/Makefile @@ -176,7 +176,7 @@ test_delegate_to: setup # Targets should be balanced to have similar run times. ci_win: ci_win1 ci_win2 ci_win3 ci_win1: test_win_group1 -ci_win2: test_win_group2 +ci_win2: test_win_group2 test_binary_modules_winrm ci_win3: test_win_group3 test_connection_winrm test_winrm: test_win_group1 test_win_group2 test_win_group3 @@ -316,6 +316,9 @@ no_log: setup # This test expects 7 loggable vars and 0 non loggable ones, if either mismatches it fails, run the ansible-playbook command to debug [ "$$(ansible-playbook no_log_local.yml -i $(INVENTORY) -e outputdir=$(TEST_DIR) -vvvvv | awk --source 'BEGIN { logme = 0; nolog = 0; } /LOG_ME/ { logme += 1;} /DO_NOT_LOG/ { nolog += 1;} END { printf "%d/%d", logme, nolog; }')" = "26/0" ] +test_binary_modules_winrm: INVENTORY = inventory.winrm +test_binary_modules_winrm: test_binary_modules + test_binary_modules: ANSIBLE_HOST_KEY_CHECKING=false ansible-playbook download_binary_modules.yml -i $(INVENTORY) -v $(TEST_FLAGS) ANSIBLE_HOST_KEY_CHECKING=false ansible-playbook test_binary_modules.yml -i $(INVENTORY) -v $(TEST_FLAGS) diff --git a/test/integration/download_binary_modules.yml b/test/integration/download_binary_modules.yml index 11accf5b3e4..456ddb4a795 100644 --- a/test/integration/download_binary_modules.yml +++ b/test/integration/download_binary_modules.yml @@ -1,10 +1,21 @@ -- hosts: all +- hosts: testhost_binary_modules tasks: - debug: var=ansible_system + - name: set module filename (POSIX) + set_fact: + module_filename: "helloworld_{{ ansible_system | lower }}" + when: ansible_system != 'Win32NT' + + - name: set module filename (Win32NT) + set_fact: + module_filename: "helloworld_{{ ansible_system | lower }}.exe" + when: ansible_system == 'Win32NT' + - name: download binary module tags: test_binary_modules - get_url: - url: "https://ansible-ci-files.s3.amazonaws.com/test/integration/roles/test_binary_modules/helloworld_{{ ansible_system|lower }}" - dest: "{{ playbook_dir }}/library/helloworld_{{ ansible_system|lower }}" + local_action: + module: get_url + url: "https://ansible-ci-files.s3.amazonaws.com/test/integration/roles/test_binary_modules/{{ module_filename }}" + dest: "{{ playbook_dir }}/library/{{ module_filename }}" mode: 0755 diff --git a/test/integration/inventory b/test/integration/inventory index 427aa3dc852..ee9e07a92bc 100644 --- a/test/integration/inventory +++ b/test/integration/inventory @@ -7,6 +7,8 @@ testhost4 ansible_ssh_host=127.0.0.4 # For testing fact gathering facthost[0:8] ansible_host=1270.0.0.1 ansible_connection=local +[binary_modules] +testhost_binary_modules ansible_host=127.0.0.1 ansible_connection=local # the following inline declarations are accompanied # by (preferred) group_vars/ and host_vars/ variables diff --git a/test/integration/inventory.winrm.template b/test/integration/inventory.winrm.template index da436ccd6b1..87c829ff63c 100644 --- a/test/integration/inventory.winrm.template +++ b/test/integration/inventory.winrm.template @@ -1,7 +1,8 @@ -[windows] -server +[windows_hosts] +windows +testhost_binary_modules -[windows:vars] +[windows_hosts:vars] ansible_connection=winrm ansible_host=@ansible_host ansible_user=@ansible_user diff --git a/test/integration/test_binary_modules.yml b/test/integration/test_binary_modules.yml index 6b1a94e6ed7..e5fd341cf24 100644 --- a/test/integration/test_binary_modules.yml +++ b/test/integration/test_binary_modules.yml @@ -1,4 +1,4 @@ -- hosts: all +- hosts: testhost_binary_modules roles: - role: test_binary_modules tags: