Make sure non-Windows CI fails when a test fails (#9303)

Make sure non-Windows CI fails when a test fails

## PR Context

We discovered that some tests were failing after a PR and the CI was not failing
This commit is contained in:
Travis Plunk
2019-04-05 15:49:30 -07:00
committed by GitHub
parent 6118c37ce3
commit e10603c4f0
+1 -51
View File
@@ -122,7 +122,6 @@ function Invoke-CIInstall
)
# Make sure we have all the tags
Sync-PSTags -AddRemoteIfMissing
$releaseTag = Get-ReleaseTag
if(Test-DailyBuild)
{
@@ -588,8 +587,6 @@ function Invoke-LinuxTestsCore
'ExcludeTag' = $testExcludeTag
'OutputFile' = $testResultsNoSudo
}
# create packages if it is a full build
$isFullBuild = Test-DailyBuild
# Get the experimental feature names and the tests associated with them
$ExperimentalFeatureTests = Get-ExperimentalFeatureTests
@@ -662,7 +659,7 @@ function Invoke-LinuxTestsCore
# Determine whether the build passed
try {
$allTestResultsWithNoExpFeature = @($pesterPassThruNoSudoObject, $pesterPassThruSudoObject)
$allTestResultsWithExpFeatures = $noSudoResultsWithExpFeatures + $sudoResultsWithExpFeatures
$allTestResultsWithExpFeatures = @($noSudoResultsWithExpFeatures, $sudoResultsWithExpFeatures)
# This throws if there was an error:
$allTestResultsWithNoExpFeature | ForEach-Object { Test-PSPesterResults -ResultObject $_ }
$allTestResultsWithExpFeatures | ForEach-Object { Test-PSPesterResults -ResultObject $_ -CanHaveNoResult }
@@ -672,53 +669,6 @@ function Invoke-LinuxTestsCore
$resultError = $_
$result = "FAIL"
}
}
# Build and test script for Linux and macOS:
function Invoke-LinuxTests
{
param(
[switch]
$SkipBuild
)
if(!$SkipBuild.IsPresent)
{
$releaseTag = Get-ReleaseTag
Write-Log -Message "Executing ci.psm1 build and test on a Linux based operating system."
$originalProgressPreference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'
try {
# We use CrossGen build to run tests only if it's the daily build.
Start-PSBuild -CrossGen -PSModuleRestore -CI -ReleaseTag $releaseTag -Configuration 'Release'
}
finally
{
$ProgressPreference = $originalProgressPreference
}
}
Invoke-LinuxTestsCore
try {
$xUnitTestResultsFile = "$pwd/xUnitTestResults.xml"
Start-PSxUnit -xUnitTestResultsFile $xUnitTestResultsFile
# If there are failures, Test-XUnitTestResults throws
Test-XUnitTestResults -TestResultsFile $xUnitTestResultsFile
} catch {
$result = "FAIL"
if (!$resultError)
{
$resultError = $_
}
}
$createPackages = $isFullBuild
if ($createPackages)
{
New-LinuxPackage -NugetKey $env:NugetKey
}
# If the tests did not pass, throw the reason why
if ( $result -eq "FAIL" )