Skip to content

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

Merged
Travis Plunk (TravisEz13) merged 2 commits into
PowerShell:masterfrom
kalgiz:select-object-fix
Apr 30, 2018
Merged

Fix Select-Object.Tests.ps1 which might fail for Unix OS.#6747
Travis Plunk (TravisEz13) merged 2 commits into
PowerShell:masterfrom
kalgiz:select-object-fix

Conversation

@kalgiz

@kalgiz Klaudia Algiz (kalgiz) commented Apr 26, 2018

Copy link
Copy Markdown
Contributor

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.

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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@TravisEz13 Travis Plunk (TravisEz13) left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Collaborator

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

Has Unix init process always?

@TravisEz13

Copy link
Copy Markdown
Member

not in docker

@TravisEz13

Copy link
Copy Markdown
Member

Klaudia Algiz (@kalgiz) can you update the title and summary for the current change?

@iSazonov

Copy link
Copy Markdown
Collaborator

Then can we replace Get-Process with custom object?

@kalgiz Klaudia Algiz (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
Copy Markdown
Contributor Author

Travis Plunk (@TravisEz13) I updated the description

@TravisEz13
Travis Plunk (TravisEz13) merged commit bee9854 into PowerShell:master Apr 30, 2018
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
…#6747)

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, probably `init` - idle, but on Unix idle process does not have the name and hence the test might fail
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