Fix the failed test and update 'Publish-TestResults' to make AzDO fail the task when any tests failed (#9457)

This commit is contained in:
Dongbo Wang 2019-04-25 14:01:05 -07:00 committed by Aditya Patwardhan
parent ceed73d737
commit 687697bc90
2 changed files with 3 additions and 4 deletions

View file

@ -1253,7 +1253,7 @@ function Publish-TestResults
# If the the "test-case" count is greater than 0, then we have results.
# Regardless, we want to upload this as an artifact, so this logic doesn't pertain to that.
if ( @(([xml](Get-Content $Path)).SelectNodes(".//test-case")).Count -gt 0 -or $Type -eq 'XUnit' ) {
Write-Host "##vso[results.publish type=$Type;mergeResults=true;runTitle=$Title;publishRunAttachments=true;resultFiles=$tempFilePath;]"
Write-Host "##vso[results.publish type=$Type;mergeResults=true;runTitle=$Title;publishRunAttachments=true;resultFiles=$tempFilePath;failTaskOnFailedTests=true]"
}
$resolvedPath = (Resolve-Path -Path $Path).ProviderPath

View file

@ -76,8 +76,7 @@ Describe "Set-Location" -Tags "CI" {
$(Get-Location).Path | Should -BeExactly $testPath.FullName
}
It "Should use actual casing of folder on case-sensitive filesystem: <dir>" -Skip:(!$IsLinux)
{
It "Should use actual casing of folder on case-sensitive filesystem: <dir>" -Skip:(!$IsLinux) {
$dir = "teST"
$testPathLower = New-Item -ItemType Directory -Path (Join-Path $TestDrive $dir.ToLower())
$testPathUpper = New-Item -ItemType Directory -Path (Join-Path $TestDrive $dir.ToUpper())
@ -85,7 +84,7 @@ Describe "Set-Location" -Tags "CI" {
$(Get-Location).Path | Should -BeExactly $testPathLower.FullName
Set-Location $testPathUpper.FullName
$(Get-Location).Path | Should -BeExactly $testPathUpper.FullName
{ Set-Locaiton (Join-Path $TestDrive $dir) } | Should -Throw -ErrorId "PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand"
{ Set-Location (Join-Path $TestDrive $dir) -ErrorAction Stop } | Should -Throw -ErrorId "PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand"
}
Context 'Set-Location with no arguments' {