mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Merge pull request #1439 from PowerShell/FixMaster
Changed Find-Package test to 'SLOW' to fix master
This commit is contained in:
commit
88973bfd14
4 files changed
+96
-17
No files matched your search
@@ -281,7 +281,7 @@ Describe "Event Test" -Tags @('BVT', 'DRT') {
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Find-Package" -Tags @('BVT', 'DRT'){
|
||||
Describe "Find-Package" -Tags @('CI','SLOW'){
|
||||
it "EXPECTED: Find a package with a location created via new-psdrive" -Skip:(-not $IsWindows) {
|
||||
$Error.Clear()
|
||||
New-PSDrive -Name xx -PSProvider FileSystem -Root $TestDrive -warningaction:silentlycontinue -ea silentlycontinue > $null; find-package -name "fooobarrr" -provider nuget -source xx:\ -warningaction:silentlycontinue -ea silentlycontinue
|
||||
|
||||
@@ -1,9 +1,93 @@
|
||||
try {
|
||||
$enlistmentRoot = git rev-parse --show-toplevel
|
||||
# Looking at pester internal to get tag filter and ExcludeTagFilter
|
||||
# This seems like the most stable way to do this
|
||||
# other options like testing for tags seems more likely to break
|
||||
|
||||
InModuleScope Pester {
|
||||
Describe 'Getting Tag Filters' -Tag CI {
|
||||
$global:__PesterTags = $pester.TagFilter
|
||||
$global:__PesterExcludeTags = $pester.ExcludeTagFilter
|
||||
}
|
||||
}
|
||||
Describe 'SDK Send Greeting Sample Tests' -Tag CI {
|
||||
|
||||
try {
|
||||
$enlistmentRoot = git rev-parse --show-toplevel
|
||||
$docLocation = Join-Path -Path $enlistmentRoot -ChildPath '\docs\cmdlet-example'
|
||||
$testResultPath = Join-Path $TestDrive 'sendgreetingresults.xml'
|
||||
$sampleCopy = Join-Path $TestDrive 'sendgreeting'
|
||||
$fullSampleCopyPath = Join-Path $sampleCopy 'cmdlet-example'
|
||||
$powershell = (Get-Process -id $PID).MainModule.FileName
|
||||
if(!(Test-Path $sampleCopy))
|
||||
{
|
||||
New-Item -ItemType Directory -Path $sampleCopy
|
||||
}
|
||||
|
||||
Copy-Item -Recurse -Path $docLocation -Destination $sampleCopy -Force
|
||||
Get-ChildItem -Recurse $sampleCopy | %{ Write-Verbose "sc: $($_.FullName)"}
|
||||
|
||||
$pesterCommand = "Invoke-Pester $sampleCopy -PassThru"
|
||||
if($global:__PesterTags)
|
||||
{
|
||||
$pesterCommand += " -Tag $(@($global:__PesterTags) -join ',')"
|
||||
}
|
||||
|
||||
if($global:__PesterExcludeTags)
|
||||
{
|
||||
$pesterCommand += " -ExcludeTag $(@($global:__PesterExcludeTags) -join ',')"
|
||||
}
|
||||
|
||||
$importPesterCommand = 'Import-module Pester'
|
||||
if($isCore)
|
||||
{
|
||||
$importPesterCommand = "Import-Module $(Join-Path -path $PSHOME -child '/Modules/Pester')"
|
||||
}
|
||||
|
||||
$command = @"
|
||||
Push-Location -Path $fullSampleCopyPath
|
||||
$importPesterCommand
|
||||
$pesterCommand | Export-Clixml -Path $testResultPath
|
||||
"@
|
||||
|
||||
Write-Verbose -Message "command: '$command'"
|
||||
$bytes = [System.Text.Encoding]::Unicode.GetBytes($command)
|
||||
$encodedCommand = [Convert]::ToBase64String($bytes)
|
||||
&$powershell -encodedCommand $encodedCommand
|
||||
|
||||
it "Should have test results file" {
|
||||
$testResultPath | should exist
|
||||
$script:results = Import-Clixml $testResultPath
|
||||
}
|
||||
|
||||
it "Should have test results" {
|
||||
$script:results | should not be BeNullOrEmpty
|
||||
$script:results.TotalCount | should not BeNullOrEmpty
|
||||
$script:results.TestResult.Count | should not BeNullOrEmpty
|
||||
}
|
||||
|
||||
it "Should have no failures" {
|
||||
$script:results.FailedCount | should be 0
|
||||
}
|
||||
|
||||
foreach($testResult in $script:results.TestResult){
|
||||
Context "Test $($testResult.Name)" {
|
||||
it "should have no failure message" {
|
||||
$testResult.FailureMessage | should BeNullOrEmpty
|
||||
}
|
||||
it "should have no stack trace" {
|
||||
$testResult.StackTrace | should BeNullOrEmpty
|
||||
}
|
||||
it "should have no error record" {
|
||||
$testResult.ErrorRecord | should BeNullOrEmpty
|
||||
}
|
||||
it "should have not failed" {
|
||||
Write-Verbose "Result: $($testResult.Result)"
|
||||
$testResult.Result | should not be Failed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
$docLocation = [io.path]::Combine($enlistmentRoot, "docs","cmdlet-example")
|
||||
Push-Location $docLocation
|
||||
./SendGreeting.Tests.ps1
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
Reference in new issue
Block a user