Further update the tests and product code to fix test failures

This commit is contained in:
Dongbo Wang 2016-10-28 10:18:19 -07:00 committed by Dongbo Wang
parent 4bb0b13e09
commit e09ddc494c
2 changed files with 21 additions and 11 deletions

View file

@ -544,7 +544,7 @@ namespace Microsoft.PowerShell.Commands
return new ErrorDetails(
typeof(ImplicitRemotingCommandBase).GetTypeInfo().Assembly,
"ImplicitRemotingStrings",
"Microsoft.PowerShell.Commands.Utility.resources.ImplicitRemotingStrings",
errorId,
args);
}

View file

@ -347,7 +347,9 @@ Describe "Tests Export-PSSession" -tags "Feature" {
It "Verifies that overwriting an existing directory succeeds with -Force" -Skip:$skipTest {
$newResults = Export-PSSession -Session $session -CommandName Get-Variable -AllowClobber -ModuleName $file -Force
@($newResults).Count | Should Be 3
# Verifies that Export-PSSession returns 4 files
@($newResults).Count | Should Be 4
# Verifies that Export-PSSession creates *new* files
$newResults | % { $_.LastWriteTime | Should BeGreaterThan $oldTimestamp }
@ -511,7 +513,7 @@ Describe "Import-PSSession with FormatAndTypes" -tags "Feature" {
{
do {
$tmpFile = [IO.Path]::Combine([IO.Path]::GetTempPath(), [IO.Path]::GetRandomFileName()) + ".ps1xml";
} while ([IO.Path]::exists($tmpFile))
} while ([IO.File]::Exists($tmpFile))
$tmpFile
}
@ -1065,7 +1067,6 @@ Describe "Implicit remoting parameter binding" -tags "Feature" {
# Sanity checks.
Invoke-Command $session {foo ([ipaddress]::parse("127.0.0.1"))} | Should Be "Bound parameter: ipaddress"
Invoke-Command $session {foo "blah"} | Should Be "Bound parameter: string"
Invoke-Command $session {gps -pid $pid | foo -Priority normal} | Should Be "Bound parameter: PriorityClass TotalProcessorTime"
$module = Import-PSSession $session foo -AllowClobber
}
@ -1441,9 +1442,9 @@ Describe "Implicit remoting parameter binding" -tags "Feature" {
Describe "Implicit remoting on restricted ISS" -tags "Feature" {
BeforeAll {
# Skip test for non-windows machines for now
# Skip the test on ARM
$skipTest = !$IsWindows -or $env:PROCESSOR_ARCHITECTURE -eq 'ARM'
# Skip tests for CoreCLR for now
# Skip tests on ARM
$skipTest = $IsCoreCLR -or $env:PROCESSOR_ARCHITECTURE -eq 'ARM'
if ($skipTest) { return }
@ -1494,12 +1495,16 @@ Describe "Implicit remoting on restricted ISS" -tags "Feature" {
Get-PSSessionConfiguration ImplicitRemotingRestrictedConfiguration* | Unregister-PSSessionConfiguration -Force
## The 'Register-PSSessionConfiguration' call below raises an AssemblyLoadException in powershell core:
## "Could not load file or assembly 'Microsoft.Powershell.Workflow.ServiceCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified."
## Issue #2555 is created to track this issue and all tests here are skipped for CoreCLR for now.
$myConfiguration = Register-PSSessionConfiguration `
-Name ImplicitRemotingRestrictedConfiguration `
-ApplicationBase (Split-Path $sessionConfigurationDll) `
-AssemblyName (Split-Path $sessionConfigurationDll -Leaf) `
-ConfigurationTypeName "MySessionConfiguration.MySessionConfiguration" `
-Force `
-Force
$session = New-RemoteSession -ConfigurationName $myConfiguration.Name
$session | Should Not Be $null
@ -2022,13 +2027,18 @@ Describe "Select-Object with implicit remoting" -tags "Feature" {
Describe "Get-FormatData used in Export-PSSession should work on DL targets" -tags "Feature" {
BeforeAll {
# Skip tests for non-windows machines for now
# Skip tests for CoreCLR for now
# Skip tests if .NET 2.0 and PS 2.0 is installed on the machine
$skipTest = !$IsWindows -or (! (Test-Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727')) -or
(! (Test-Path 'HKLM:\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine'))
$skipTest = $IsCoreCLR -or (! (Test-Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727')) -or
(! (Test-Path 'HKLM:\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine'))
if ($skipTest) { return }
## The call to 'Register-PSSessionConfiguration -PSVersion 2.0' below raises and exception:
## `Cannot bind parameter 'PSVersion' to the target. Exception setting "PSVersion": "Windows PowerShell 2.0 is not installed.
## Install Windows PowerShell 2.0, and then try again."`
## Issue #2556 is created to track this issue and the test here is skipped for CoreCLR for now.
$configName = "DLConfigTest"
$null = Register-PSSessionConfiguration -Name $configName -PSVersion 2.0 -Force
$session = New-RemoteSession -ConfigurationName $configName