Skip to content
Merged
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 @@ -115,6 +115,8 @@ try
}

$LocalConfigFilePath = CreateTestConfigFile

$expectedPSVersion = "$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor)"
}
}

Expand All @@ -125,15 +127,15 @@ try
$Result = Get-PSSessionConfiguration

$Result.Name -contains $endpointName | Should Be $true
$Result.PSVersion -ge 5.1 | Should be $true
$Result.PSVersion | Should BeExactly $expectedPSVersion
}

It "Get-PSSessionConfiguration with Name parameter" {

$Result = Get-PSSessionConfiguration -Name $endpointName

$Result.Name | Should Be $endpointName
$Result.PSVersion -ge 5.1 | Should be $true
$Result.PSVersion | Should BeExactly $expectedPSVersion
}

It "Get-PSSessionConfiguration -Name with wildcard character" {
Expand All @@ -143,7 +145,7 @@ try
$Result = Get-PSSessionConfiguration -Name $endpointWildcard

$Result.Name -contains $endpointName | Should Be $true
$Result.PSVersion -ge 5.1 | Should be $true
$Result.PSVersion | Should BeExactly $expectedPSVersion
}

It "Get-PSSessionConfiguration -Name with Non-Existent session configuration" {
Expand Down Expand Up @@ -324,6 +326,8 @@ try
BeforeAll {
if ($IsNotSkipped)
{
$expectedPSVersion = "$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor)"

function ValidateRemoteEndpoint {
param ($TestSessionConfigName, $ScriptToExecute, $ExpectedOutput)

Expand Down Expand Up @@ -488,7 +492,7 @@ namespace PowershellTestConfigNamespace

$Result.Session.Name | Should be $TestSessionConfigName
$Result.Session.SessionType | Should be "Default"
$Result.Session.PSVersion | Should be 6.0
$Result.Session.PSVersion | Should BeExactly $expectedPSVersion
Copy link
Contributor

Choose a reason for hiding this comment

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

I am still not convinced changing this from a string literal to the variable is the right move. Please provide answers to the question in the other PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The tests should work on all PowerShell Core versions without changes.
We don't pass-through the version constant, we evaluate it. So we should have a contract for this in the tests.

$Result.Session.Enabled | Should be $true
$Result.Session.lang | Should be $Result.Culture
$Result.Session.pssessionthreadoptions | Should be $pssessionthreadoptions
Expand All @@ -497,6 +501,15 @@ namespace PowershellTestConfigNamespace
$Result.Session.UseSharedProcess | Should be $UseSharedProcess
}

It "Validate Register-PSSessionConfiguration -PSVersion" {

Register-PSSessionConfiguration -Name $TestSessionConfigName -PSVersion 5.1
$Session = Get-PSSessionConfiguration -Name $TestSessionConfigName

$Session.Name | Should be $TestSessionConfigName
$Session.PSVersion | Should BeExactly 5.1
}

It "Validate Register-PSSessionConfiguration -startupscript parameter" -Pending {

$null = Register-PSSessionConfiguration -Name $TestSessionConfigName -path $LocalConfigFilePath -StartupScript $LocalStartupScriptPath -Force
Expand Down Expand Up @@ -557,7 +570,7 @@ namespace PowershellTestConfigNamespace
$Result = [PSObject]@{Session = (Get-PSSessionConfiguration -Name $TestSessionConfigName) ; Culture = (Get-Item WSMan:\localhost\Plugin\microsoft.powershell\lang -ea SilentlyContinue).value}

$Result.Session.Name | Should be $TestSessionConfigName
$Result.Session.PSVersion | Should be 6.0
$Result.Session.PSVersion | Should BeExactly $expectedPSVersion
Copy link
Contributor

Choose a reason for hiding this comment

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

same

$Result.Session.Enabled | Should be $true
$Result.Session.lang | Should be $result.Culture
$Result.Session.pssessionthreadoptions | Should be $pssessionthreadoptions
Expand All @@ -566,6 +579,15 @@ namespace PowershellTestConfigNamespace
$Result.Session.UseSharedProcess | Should be $UseSharedProcess
}

It "Validate Set-PSSessionConfiguration -PSVersion" {
Copy link
Member

Choose a reason for hiding this comment

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

This test is very similar to the test at L504. Can you use -testcases?

Copy link
Member

Choose a reason for hiding this comment

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

I think it's fine to keep it as is. This Context is for Set-PSSessionConfiguration and the one above is in the Context of Register-PSSessionConfiguration.


Set-PSSessionConfiguration -Name $TestSessionConfigName -PSVersion 5.1
$Session = (Get-PSSessionConfiguration -Name $TestSessionConfigName)

$Session.Name | Should be $TestSessionConfigName
$Session.PSVersion | Should BeExactly 5.1
}

It "Validate Set-PSSessionConfiguration -startupscript parameter" -Pending {

$null = Set-PSSessionConfiguration -Name $TestSessionConfigName -StartupScript $LocalStartupScriptPath
Expand Down