Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,44 @@ $InternalSource = 'OneGetTestSource'


Describe "PackageManagement Acceptance Test" -Tags "Feature" {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, please avoid making formatting changes in the same PR as code change per the Coding Conventions.

BeforeAll{
Register-PackageSource -Name Nugettest -provider NuGet -Location https://www.nuget.org/api/v2 -force
Register-PackageSource -Name $InternalSource -Location $InternalGallery -ProviderName 'PowerShellGet' -Trusted -ErrorAction SilentlyContinue

$SavedProgressPreference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
}
AfterAll {
$ProgressPreference = $SavedProgressPreference
}
It "get-packageprovider" {

$gpp = Get-PackageProvider

$gpp | ?{ $_.name -eq "NuGet" } | should not BeNullOrEmpty
$gpp | ?{ $_.name -eq "PowerShellGet" } | should not BeNullOrEmpty

$gpp | ?{ $_.name -eq "PowerShellGet" } | should not BeNullOrEmpty
}


It "find-packageprovider PowerShellGet" {
$fpp = (Find-PackageProvider -Name "PowerShellGet" -force).name
$fpp = (Find-PackageProvider -Name "PowerShellGet" -force).name
$fpp -contains "PowerShellGet" | should be $true
}

It "install-packageprovider, Expect succeed" {
$ipp = (install-PackageProvider -name gistprovider -force -source $InternalSource -Scope CurrentUser).name
$ipp -contains "gistprovider" | should be $true
$ipp = (install-PackageProvider -name gistprovider -force -source $InternalSource -Scope CurrentUser).name
$ipp -contains "gistprovider" | should be $true
}


it "Find-package" {
$f = Find-Package -ProviderName NuGet -Name jquery -source Nugettest
$f.Name -contains "jquery" | should be $true
}

it "Install-package" {
$i = install-Package -ProviderName NuGet -Name jquery -force -source Nugettest -Scope CurrentUser
$i = install-Package -ProviderName NuGet -Name jquery -force -source Nugettest -Scope CurrentUser
$i.Name -contains "jquery" | should be $true
}

Expand Down
3 changes: 3 additions & 0 deletions test/powershell/engine/Help/HelpSystem.OnlineHelp.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# (when calling get-help -online) might not matched the one in the csv file.

BeforeAll {
$SavedProgressPreference = $ProgressPreference

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a Pester issues, but this pattern can result in the preference not being set back to the original setting. What should we do about this:

  • File an issue with Pester
  • Use another pattern
  • Live with the issue
  • Some other option

Example Code:

PS C:\Users\tplunk> Describe 'before all after all' {
    BeforeAll{
        Write-Verbose "in BeforeAll" -Verbose
        
    }
    it "it" {
        Start-Sleep -Seconds 2

    }
    AfterAll {
        Write-Verbose "in AfterAll" -Verbose
        
    }
}

Example hitting ctl-c during it:

Describing before all after all
VERBOSE: in BeforeAll
VERBOSE: in it
Note: After all was not run

Example of full run

Describing before all after all
VERBOSE: in BeforeAll
VERBOSE: in it
[+] it 2.13s
VERBOSE: in AfterAll

@JamesWTruher James Truher (JamesWTruher) Dec 6, 2016 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll file an issue with the Pester, this isn't likely to happen in a run (as there's no one to press CRL-C) - This problem is general in pester over all.
I've opened pester/Pester#655

$ProgressPreference = "SilentlyContinue"

# Enable the test hook
[system.management.automation.internal.internaltesthooks]::SetTestHook('BypassOnlineHelpRetrieval', $true)
Expand All @@ -24,6 +26,7 @@

# Disable the test hook
[system.management.automation.internal.internaltesthooks]::SetTestHook('BypassOnlineHelpRetrieval', $false)
$ProgressPreference = $SavedProgressPreference
}

foreach ($filePath in @("$PSScriptRoot\assets\HelpURI\V2Cmdlets.csv", "$PSScriptRoot\assets\HelpURI\V3Cmdlets.csv"))
Expand Down
21 changes: 20 additions & 1 deletion test/powershell/engine/Help/HelpSystem.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,33 @@ function RunTestCase
}

Describe "Validate that get-help <cmdletName> works" -Tags @('CI', 'RequireAdminOnWindows') {

BeforeAll {
$SavedProgressPreference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
}
AfterAll {
$ProgressPreference = $SavedProgressPreference
}
RunTestCase -tag "CI"
}

Describe "Validate Get-Help for all cmdlets in 'Microsoft.PowerShell.Core'" -Tags @('Feature', 'RequireAdminOnWindows') {
BeforeAll {
$SavedProgressPreference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
}
AfterAll {
$ProgressPreference = $SavedProgressPreference
}

RunTestCase -tag "Feature"
}

Describe "Validate that Get-Help returns provider-specific help" -Tags @('CI', 'RequireAdminOnWindows') {
BeforeAll {
$SavedProgressPreference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"

$namespaces = @{
command = 'http://schemas.microsoft.com/maml/dev/command/2004/10'
dev = 'http://schemas.microsoft.com/maml/dev/2004/10'
Expand Down Expand Up @@ -119,6 +135,9 @@ Describe "Validate that Get-Help returns provider-specific help" -Tags @('CI', '
UpdateHelpFromLocalContentPath -ModuleName 'Microsoft.PowerShell.Core' -Tag 'CI'
}

AfterAll {
$ProgressPreference = $SavedProgressPreference
}
It -Skip:(-not $IsWindows) "shows contextual help when Get-Help is invoked for provider-specific path (Get-Help -Name <verb>-<noun> -Path <path>)" -TestCases $testCases {
param($helpFile, $path, $helpContext, $verb, $noun)

Expand Down
46 changes: 44 additions & 2 deletions test/powershell/engine/Help/UpdatableHelpSystem.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ $testCases = @{
}

<#
This scenario is broken due to issue # https://github.com/PowerShell/platyPS/issues/241
This scenario is broken due to issue # https://github.com/PowerShell/platyPS/issues/241
Re-enable when issue is fixed.
"Microsoft.PowerShell.Archive" = @{
HelpFiles = "Microsoft.PowerShell.Archive.psm1-help.xml"
Expand Down Expand Up @@ -141,7 +141,7 @@ function GetFiles
[ValidateNotNullOrEmpty()]
[string]$path
)

Get-ChildItem $path -Include $fileType -Recurse -ea SilentlyContinue | Select-Object -ExpandProperty FullName
}

Expand Down Expand Up @@ -275,29 +275,71 @@ function ValidateSaveHelp
}

Describe "Validate Update-Help from the Web for one PowerShell Core module." -Tags @('CI', 'RequireAdminOnWindows') {
BeforeAll {
$SavedProgressPreference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
}
AfterAll {
$ProgressPreference = $SavedProgressPreference
}

RunUpdateHelpTests -tag "CI" -Pending
}

Describe "Validate Update-Help from the Web for all PowerShell Core modules." -Tags @('Feature', 'RequireAdminOnWindows') {
BeforeAll {
$SavedProgressPreference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
}
AfterAll {
$ProgressPreference = $SavedProgressPreference
}

RunUpdateHelpTests -tag "Feature"
}

Describe "Validate Update-Help -SourcePath for one PowerShell Core module." -Tags @('CI', 'RequireAdminOnWindows') {
BeforeAll {
$SavedProgressPreference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
}
AfterAll {
$ProgressPreference = $SavedProgressPreference
}

RunUpdateHelpTests -tag "CI" -useSourcePath
}

Describe "Validate Update-Help -SourcePath for all PowerShell Core modules." -Tags @('Feature', 'RequireAdminOnWindows') {
BeforeAll {
$SavedProgressPreference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
}
AfterAll {
$ProgressPreference = $SavedProgressPreference
}

RunUpdateHelpTests -tag "Feature" -useSourcePath
}

Describe "Validate 'Save-Help -DestinationPath for one PowerShell Core modules." -Tags @('CI', 'RequireAdminOnWindows') {
BeforeAll {
$SavedProgressPreference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
}
AfterAll {
$ProgressPreference = $SavedProgressPreference
}
RunSaveHelpTests -tag "CI" -Pending
}

Describe "Validate 'Save-Help -DestinationPath for all PowerShell Core modules." -Tags @('Feature', 'RequireAdminOnWindows') {
BeforeAll {
$SavedProgressPreference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
}
AfterAll {
$ProgressPreference = $SavedProgressPreference
}
RunSaveHelpTests -tag "Feature"
}