Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix Select-Object.Tests.ps1 which might fail for Unix OS.#6747

Merged
TravisEz13 merged 2 commits intoPowerShell:masterfrom
kalgiz:select-object-fix
Apr 30, 2018
Merged

Fix Select-Object.Tests.ps1 which might fail for Unix OS.#6747
TravisEz13 merged 2 commits intoPowerShell:masterfrom
kalgiz:select-object-fix

Conversation

@kalgiz
Copy link
Contributor

@kalgiz kalgiz commented Apr 26, 2018

PR Summary

Fix Select-Object.Tests.ps1 which might fail for Unix OS.
In the test the processes which name matches i* are selected and it checks if there is non zero number of these processes. The test assumes that there is always at least one process - idle, but on Unix idle process does not have the name and hence the test might fail

PR Checklist

…since idle process doesn't have a name specified on Unix.
@kalgiz kalgiz requested a review from TravisEz13 April 26, 2018 22:28

It "Select-Object with Start-Time In Idle Process should work"{
It "Select-Object with Start-Time In Idle Process should work" -Skip:(!$IsWindows) {
$results = Get-Process i* | Select-Object ProcessName
Copy link
Member

Choose a reason for hiding this comment

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

Why not just change it to Get-Process * removing the i from i* ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Member

@TravisEz13 TravisEz13 left a comment

Choose a reason for hiding this comment

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

see comments

@iSazonov
Copy link
Collaborator

The test assumes that there is always at least one process - idle,

Has Unix init process always?

@TravisEz13
Copy link
Member

not in docker

@TravisEz13
Copy link
Member

@kalgiz can you update the title and summary for the current change?

@iSazonov
Copy link
Collaborator

Then can we replace Get-Process with custom object?

@kalgiz kalgiz changed the title Skip the test from Select-Object.Tests.ps1 for Unix since it might fail on this OS. Fix Select-Object.Tests.ps1 which might fail for Unix OS. Apr 30, 2018
@kalgiz
Copy link
Contributor Author

kalgiz commented Apr 30, 2018

@TravisEz13 I updated the description

@TravisEz13 TravisEz13 merged commit bee9854 into PowerShell:master Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants