Skip to content

Updated thread job to version 1.1.2 - #7522

Merged
Travis Plunk (TravisEz13) merged 5 commits into
PowerShell:masterfrom
PaulHigin:update-threadjob-version
Aug 15, 2018
Merged

Travis Plunk (TravisEz13) merged 5 commits into
PowerShell:masterfrom
PaulHigin:update-threadjob-version

Conversation

@PaulHigin

Copy link
Copy Markdown
Contributor

PR Summary

Added fix to remove unneeded validation attribute for Arguments parameter, and made tests work with strict mode.

PR Checklist

…dation attribute for Arguments parameter, and made test work with strict mode

@SteveL-MSFT Steve Lee (SteveL-MSFT) 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.

LGTM

@dantraMSFT Dan Travison (dantraMSFT) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

}

$numThreadJobs = (Get-Job | where PSJobTypeName -eq "ThreadJob").Count
$numThreadJobs = @(Get-Job | where PSJobTypeName -eq "ThreadJob").Count

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.

Pester 4 syntax has -HaveCount. This can be converted to:

@(Get-Job | where-object { PSJobTypeName -eq "ThreadJob"}) | Should -HaveCount 0

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.

Thanks. Will change.

}

$numThreadJobs = (Get-Job | where PSJobTypeName -eq "ThreadJob").Count
$numThreadJobs = @(Get-Job | where PSJobTypeName -eq "ThreadJob").Count

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.

Do not use alias where -> Where-Object

$null = $job1,$job2,$job3,$job4 | Receive-Job -Wait -AutoRemoveJob

(Get-Job | where PSJobTypeName -eq "ThreadJob").Count | Should -Be 0
@(Get-Job | where PSJobTypeName -eq "ThreadJob").Count | Should -Be 0

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.

Please use -HaveCount.

$null = $job1,$job2,$job3,$job4 | Receive-Job -Wait -AutoRemoveJob

(Get-Job | where PSJobTypeName -eq "ThreadJob").Count | Should -Be 0
@(Get-Job | where PSJobTypeName -eq "ThreadJob").Count | Should -Be 0

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.

where -> Where-Object


$numRunningThreadJobs = (Get-Job | where { ($_.PSJobTypeName -eq "ThreadJob") -and ($_.State -eq "Running") }).Count
$numQueuedThreadJobs = (Get-Job | where { ($_.PSJobTypeName -eq "ThreadJob") -and ($_.State -eq "NotStarted") }).Count
$numRunningThreadJobs = @(Get-Job | where { ($_.PSJobTypeName -eq "ThreadJob") -and ($_.State -eq "Running") }).Count

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.

where -> Where-Object

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.

Approved with one comment about an alias where


$numThreadJobs = (Get-Job | where PSJobTypeName -eq "ThreadJob").Count
$numThreadJobs | Should -Be 0
Get-Job | where PSJobTypeName -eq "ThreadJob" | Should -HaveCount 0

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.

Missed one where here.

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.

Got it. Thanks.

@TravisEz13
Travis Plunk (TravisEz13) merged commit a213667 into PowerShell:master Aug 15, 2018
@PaulHigin
Paul Higinbotham (PaulHigin) deleted the update-threadjob-version branch August 15, 2018 14:13
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Added fix to remove unneeded validation attribute for Arguments parameter, and made tests work with strict mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WG-Maintainers-Build specific to affecting the build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants