param( # The test type ot be run (unit, integration or functional) [Parameter(Position=0)][String]$TestType ) . { Invoke-WebRequest -useb https://omnitruck.chef.io/chef/install.ps1 } | Invoke-Expression; install -channel "current" -project "chef-foundation" -v $CHEF_FOUNDATION_VERSION $env:Path = 'C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Git\cmd;C:\Users\ContainerAdministrator\AppData\Local\Microsoft\WindowsApps;C:\opscode\chef\bin;C:\opscode\chef\embedded\bin' if ($TestType -eq 'Functional') { winrm quickconfig -q } Write-Output "--- Running Chef bundle install" bundle install --jobs=3 --retry=3 switch ($TestType) { "Unit" {[string[]]$RakeTest = 'spec:unit','component_specs'; break} "Integration" {[string[]]$RakeTest = "spec:integration"; break} "Functional" {[string[]]$RakeTest = "spec:functional"; break} default {throw "TestType $TestType not valid"} } foreach($test in $RakeTest) { Write-Output "--- Chef $test run" bundle exec rake $test if (-not $?) { throw "Chef $test tests failed" } }