Further update the tests and product code to fix test failures
This commit is contained in:
parent
4bb0b13e09
commit
e09ddc494c
|
@ -544,7 +544,7 @@ namespace Microsoft.PowerShell.Commands
|
||||||
|
|
||||||
return new ErrorDetails(
|
return new ErrorDetails(
|
||||||
typeof(ImplicitRemotingCommandBase).GetTypeInfo().Assembly,
|
typeof(ImplicitRemotingCommandBase).GetTypeInfo().Assembly,
|
||||||
"ImplicitRemotingStrings",
|
"Microsoft.PowerShell.Commands.Utility.resources.ImplicitRemotingStrings",
|
||||||
errorId,
|
errorId,
|
||||||
args);
|
args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -347,7 +347,9 @@ Describe "Tests Export-PSSession" -tags "Feature" {
|
||||||
|
|
||||||
It "Verifies that overwriting an existing directory succeeds with -Force" -Skip:$skipTest {
|
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 = 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
|
# Verifies that Export-PSSession creates *new* files
|
||||||
$newResults | % { $_.LastWriteTime | Should BeGreaterThan $oldTimestamp }
|
$newResults | % { $_.LastWriteTime | Should BeGreaterThan $oldTimestamp }
|
||||||
|
@ -511,7 +513,7 @@ Describe "Import-PSSession with FormatAndTypes" -tags "Feature" {
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
$tmpFile = [IO.Path]::Combine([IO.Path]::GetTempPath(), [IO.Path]::GetRandomFileName()) + ".ps1xml";
|
$tmpFile = [IO.Path]::Combine([IO.Path]::GetTempPath(), [IO.Path]::GetRandomFileName()) + ".ps1xml";
|
||||||
} while ([IO.Path]::exists($tmpFile))
|
} while ([IO.File]::Exists($tmpFile))
|
||||||
$tmpFile
|
$tmpFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1065,7 +1067,6 @@ Describe "Implicit remoting parameter binding" -tags "Feature" {
|
||||||
# Sanity checks.
|
# Sanity checks.
|
||||||
Invoke-Command $session {foo ([ipaddress]::parse("127.0.0.1"))} | Should Be "Bound parameter: ipaddress"
|
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 {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
|
$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" {
|
Describe "Implicit remoting on restricted ISS" -tags "Feature" {
|
||||||
|
|
||||||
BeforeAll {
|
BeforeAll {
|
||||||
# Skip test for non-windows machines for now
|
# Skip tests for CoreCLR for now
|
||||||
# Skip the test on ARM
|
# Skip tests on ARM
|
||||||
$skipTest = !$IsWindows -or $env:PROCESSOR_ARCHITECTURE -eq 'ARM'
|
$skipTest = $IsCoreCLR -or $env:PROCESSOR_ARCHITECTURE -eq 'ARM'
|
||||||
|
|
||||||
if ($skipTest) { return }
|
if ($skipTest) { return }
|
||||||
|
|
||||||
|
@ -1494,12 +1495,16 @@ Describe "Implicit remoting on restricted ISS" -tags "Feature" {
|
||||||
|
|
||||||
Get-PSSessionConfiguration ImplicitRemotingRestrictedConfiguration* | Unregister-PSSessionConfiguration -Force
|
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 `
|
$myConfiguration = Register-PSSessionConfiguration `
|
||||||
-Name ImplicitRemotingRestrictedConfiguration `
|
-Name ImplicitRemotingRestrictedConfiguration `
|
||||||
-ApplicationBase (Split-Path $sessionConfigurationDll) `
|
-ApplicationBase (Split-Path $sessionConfigurationDll) `
|
||||||
-AssemblyName (Split-Path $sessionConfigurationDll -Leaf) `
|
-AssemblyName (Split-Path $sessionConfigurationDll -Leaf) `
|
||||||
-ConfigurationTypeName "MySessionConfiguration.MySessionConfiguration" `
|
-ConfigurationTypeName "MySessionConfiguration.MySessionConfiguration" `
|
||||||
-Force `
|
-Force
|
||||||
|
|
||||||
$session = New-RemoteSession -ConfigurationName $myConfiguration.Name
|
$session = New-RemoteSession -ConfigurationName $myConfiguration.Name
|
||||||
$session | Should Not Be $null
|
$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" {
|
Describe "Get-FormatData used in Export-PSSession should work on DL targets" -tags "Feature" {
|
||||||
BeforeAll {
|
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
|
# 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
|
$skipTest = $IsCoreCLR -or (! (Test-Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727')) -or
|
||||||
(! (Test-Path 'HKLM:\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine'))
|
(! (Test-Path 'HKLM:\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine'))
|
||||||
|
|
||||||
if ($skipTest) { return }
|
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"
|
$configName = "DLConfigTest"
|
||||||
$null = Register-PSSessionConfiguration -Name $configName -PSVersion 2.0 -Force
|
$null = Register-PSSessionConfiguration -Name $configName -PSVersion 2.0 -Force
|
||||||
$session = New-RemoteSession -ConfigurationName $configName
|
$session = New-RemoteSession -ConfigurationName $configName
|
||||||
|
|
Loading…
Reference in a new issue