You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It "We chose to skip this as $($PSItem.JobName)'s last run outcome is unknown on $($PSItem.InstanceName)"-Skip {
172
-
$PSItem.LastRunOutcome| Should -Be $PSItem.ExpectedOutcome-Because 'All Agent Jobs should have succeed this one is unknown - you need to investigate the failed jobs'
173
-
}
167
+
Context "Checking for failed enabled jobs since on <_.Name>" {
168
+
if (-not$skipAgentFailedJobs) {
169
+
It "We chose to skip this as <_.JobName>'s last run outcome is unknown on <_.InstanceName>"-Skip -ForEach ($PSItem.JobsFailed|Where-Object { $_.LastRunOutcome-eq"Unknown" }) {
170
+
$PSItem.LastRunOutcome| Should -Be $PSItem.ExpectedOutcome-Because 'All Agent Jobs should have succeed this one is unknown - you need to investigate the failed jobs'
It "You chose to skip this as $($PSItem.JobName)'s last run outcome is cancelled on $($PSItem.InstanceName)"-Skip {
177
-
$PSItem.LastRunOutcome| Should -Be $PSItem.ExpectedOutcome-Because 'All Agent Jobs should have succeed this one is Cancelled - you need to investigate the failed jobs'
178
-
}
179
-
}
180
-
else {
181
-
It "Job $($PSItem.JobName) last run outcome is $($PSItem.LastRunOutcome) on $($PSItem.InstanceName)"-Skip:$skipAgentFailedJobs {
182
-
$PSItem.LastRunOutcome| Should -Be $PSItem.ExpectedOutcome-Because "All Agent Jobs should have succeed - you need to investigate the failed jobs"
183
-
}
172
+
It "You chose to skip this as <_.JobName>'s last run outcome is cancelled on <_.InstanceName>"-Skip -ForEach ($PSItem.JobsFailed|Where-Object { $_.LastRunOutcome-eq"Cancelled"-and ($excludecancelled-eq$true) }) {
173
+
$PSItem.LastRunOutcome| Should -Be $PSItem.ExpectedOutcome-Because 'All Agent Jobs should have succeed this one is Cancelled - you need to investigate the failed jobs'
184
174
}
185
175
}
176
+
It "Job <_.JobName> last run outcome is <_.LastRunOutcome> on <_.InstanceName>"-Skip:$skipAgentFailedJobs-ForEach ($PSItem.JobsFailed|Where-Object { $_.LastRunOutcome-notin ("Cancelled","Unknown") }) {
177
+
$PSItem.LastRunOutcome| Should -Be $PSItem.ExpectedOutcome-Because "All Agent Jobs should have succeed - you need to investigate the failed jobs"
0 commit comments