Updating tests to install the help content before running on Windows

This commit is contained in:
Francisco Gamino 2016-08-10 11:47:34 -07:00
parent 2b1dc87774
commit 135af2089a
4 changed files with 35 additions and 6 deletions

View file

@ -17,7 +17,7 @@
},
"runtimes": {
"ubuntu.16.04-x64": { },
"ubuntu.16.04-x64": { },
"ubuntu.14.04-x64": { },
"debian.8-x64": { },
"centos.7-x64": { },

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<HelpInfo xmlns="http://schemas.microsoft.com/powershell/help/2010/05">
<HelpContentURI>http://go.microsoft.com/fwlink/?linkid=390782</HelpContentURI>
<SupportedUICultures>
<UICulture>
<UICultureName>en-US</UICultureName>
<UICultureVersion>5.0.7.0</UICultureVersion>
</UICulture>
</SupportedUICultures>
</HelpInfo>

View file

@ -5,7 +5,29 @@ function RunTestCase
{
param ([string]$tag = "CI")
$cmdlets = get-command -module "Microsoft.PowerShell.Core"
$moduleName = "Microsoft.PowerShell.Core"
if ($IsWindows)
{
if ($tag -eq "CI")
{
$helpContentPath = join-path $PSScriptRoot "HelpContent"
$helpFiles = @(Get-ChildItem "$helpContentPath\*" -ea SilentlyContinue)
if ($helpFiles.Count -eq 0)
{
throw "unable to find help content at '$helpContentPath'"
}
Update-Help -Module $moduleName -SourcePath $helpContentPath -Force -ErrorAction Stop -Verbose
}
else
{
Update-Help -Module $moduleName -Force -Verbose -ErrorAction Stop
}
}
$cmdlets = get-command -module $moduleName
$cmdletsToSkip = @(
"Get-PSHostProcessInfo",
@ -13,8 +35,6 @@ function RunTestCase
"Register-ArgumentCompleter"
)
$testCaseExecuted = $false
foreach ($cmdletName in $cmdlets)
{
if ($cmdletsToSkip -notcontains $cmdletName)
@ -24,10 +44,9 @@ function RunTestCase
$help = get-help -name $cmdletName
$help.Description | Out-String | Should Match $cmdletName
$help.Examples | Out-String | Should Match $cmdletName
$testCaseExecuted = $true
}
if (($tag -eq "CI") -and $testCaseExecuted)
if ($tag -eq "CI")
{
# For a CI test run, we are only interested in validating one cmdlet to ensure that
# get-help <cmdletName> works.