Add tests for windows setup module.

This commit is contained in:
Chris Church 2014-06-19 12:25:44 -05:00 committed by Matt Martz
parent bceaf96fd6
commit 5b85252043
3 changed files with 38 additions and 3 deletions

View file

@ -28,7 +28,6 @@ $powershellpath = "C:\powershell"
function download-file
{
Get-Process | Out-File c:\powershell\whatisrunningrightnow.txt
param ([string]$path, [string]$local)
$client = new-object system.net.WebClient
$client.Headers.Add("user-agent", "PowerShell")
@ -78,6 +77,6 @@ else
}
$FileName = $DownLoadUrl.Split('/')[-1]
# download-file $downloadurl "$powershellpath\$filename"
download-file $downloadurl "$powershellpath\$filename"
write-host "$powershellpath\$filename"
."$powershellpath\$filename" /quiet /log "C:\powershell\install.log"

View file

@ -0,0 +1,35 @@
# test code for the setup module when using winrm connection
# (c) 2014, Chris Church <chris@ninemoreminutes.com>
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- name: test setup module
action: setup
register: setup_result
- name: check setup result
assert:
that:
- "not setup_result|failed"
- "not setup_result|changed"
- "setup_result.ansible_facts"
- "setup_result.ansible_facts.ansible_os_family == 'Windows'"
- "setup_result.ansible_facts.ansible_distribution"
- "setup_result.ansible_facts.ansible_distribution_version"
- "setup_result.ansible_facts.ansible_fqdn"
- "setup_result.ansible_facts.ansible_hostname"
- "setup_result.ansible_facts.ansible_ip_addresses"
- "setup_result.ansible_facts.ansible_system"

View file

@ -6,6 +6,7 @@
- { role: test_win_raw, tags: test_win_raw }
- { role: test_win_script, tags: test_win_script }
- { role: test_win_ping, tags: test_win_ping }
- { role: test_win_setup, tags: test_win_setup }
- { role: test_win_slurp, tags: test_win_slurp }
- { role: test_win_fetch, tags: test_win_fetch }
- { role: test_win_stat, tags: test_win_stat }