X Tutup
The Wayback Machine - https://web.archive.org/web/20221029031638/https://github.com/PowerShell/PowerShell/pull/5554
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PSVersion in PSSessionConfiguration tests #5554

Merged

Conversation

iSazonov
Copy link
Collaborator

@iSazonov iSazonov commented Nov 27, 2017

Check that we can register and change (Set-) remote endpoint
configurations with given PSVersion.

markekraus
markekraus previously requested changes Nov 27, 2017
@@ -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

@markekraus markekraus Nov 27, 2017

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

@iSazonov iSazonov Nov 27, 2017

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.

@@ -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

@markekraus markekraus Nov 27, 2017

Choose a reason for hiding this comment

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

same

@@ -566,6 +579,15 @@ namespace PowershellTestConfigNamespace
$Result.Session.UseSharedProcess | Should be $UseSharedProcess
}

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

@adityapatwardhan adityapatwardhan Nov 27, 2017

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

@daxian-dbw daxian-dbw Nov 28, 2017

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.

@@ -115,6 +115,8 @@ try
}

$LocalConfigFilePath = CreateTestConfigFile

$expectedPSVersion = "$($PSVersionTable.PSVersion.Major)`.$($PSVersionTable.PSVersion.Minor)"
Copy link
Member

@daxian-dbw daxian-dbw Nov 28, 2017

Choose a reason for hiding this comment

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

`.

The backtick is not necessary.

Copy link
Collaborator Author

@iSazonov iSazonov Nov 28, 2017

Choose a reason for hiding this comment

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

Removed.

@@ -470,6 +472,8 @@ namespace PowershellTestConfigNamespace
$TestSessionConfigName = "TestRegisterPSSesionConfig"
Unregister-PSSessionConfiguration -Name $TestSessionConfigName -Force -NoServiceRestart -ErrorAction SilentlyContinue
}

$expectedPSVersion = "$($PSVersionTable.PSVersion.Major)`.$($PSVersionTable.PSVersion.Minor)"
Copy link
Member

@daxian-dbw daxian-dbw Nov 28, 2017

Choose a reason for hiding this comment

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

I think this should be moved to the BeforeAll block of the Describe, otherwise the use of $expectedPSVersion below from a different Context block won't see the variable.

And the backtick is not necessary.

Copy link
Collaborator Author

@iSazonov iSazonov Nov 28, 2017

Choose a reason for hiding this comment

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

Fixed.


$Session.Name | Should be $TestSessionConfigName
$Session.PSVersion | Should Be 5.1
}
Copy link
Member

@daxian-dbw daxian-dbw Nov 28, 2017

Choose a reason for hiding this comment

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

Please fix the indentation of this it block.

Copy link
Collaborator Author

@iSazonov iSazonov Nov 28, 2017

Choose a reason for hiding this comment

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

Fixed.

@@ -566,6 +579,15 @@ namespace PowershellTestConfigNamespace
$Result.Session.UseSharedProcess | Should be $UseSharedProcess
}

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

@daxian-dbw daxian-dbw Nov 28, 2017

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.

@daxian-dbw
Copy link
Member

daxian-dbw commented Nov 28, 2017

@iSazonov Please add the [Feature] tag to the last commit message to verify whether the changes fix the test failure.

@daxian-dbw
Copy link
Member

daxian-dbw commented Nov 28, 2017

I will add the [Feature] tag to the last commit to trigger the full test run.

@daxian-dbw daxian-dbw force-pushed the fix-pssessionconfiguration-tests branch from 2bab0cd to 1ef532a Compare Nov 28, 2017
@@ -566,6 +579,15 @@ namespace PowershellTestConfigNamespace
$Result.Session.UseSharedProcess | Should be $UseSharedProcess
}

It "Validate Set-PSSessionConfiguration -PSVersion" {

Set-PSSessionConfiguration -Name $TestSessionConfigName -PSVerion 5.1
Copy link
Contributor

@markekraus markekraus Nov 28, 2017

Choose a reason for hiding this comment

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

should be -PSVersion (missing an s)

@adityapatwardhan
Copy link
Member

adityapatwardhan commented Nov 28, 2017

Restarted job on Travis-CI as one test failed due to intermittent failure.

@TravisEz13
Copy link
Member

TravisEz13 commented Nov 28, 2017

Filed #5567 for travis-ci test failure

@adityapatwardhan adityapatwardhan merged commit 910c5a4 into PowerShell:master Nov 28, 2017
@TravisEz13 TravisEz13 added this to the 6.1.0-MQ milestone Nov 29, 2017
@TravisEz13
Copy link
Member

TravisEz13 commented Nov 29, 2017

Not taking for GA because this was caused by a change that is only in master branch

@iSazonov iSazonov deleted the fix-pssessionconfiguration-tests branch Nov 29, 2017
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants
X Tutup