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
Context "Testing Agent Alerts Severity exists on <_.Name>" {
192
+
It "Severity <_.AgentAlertSeverity> Alert should exist on <_.InstanceName>"-Skip:$skipAgentAlerts-ForEach ($PSItem.AgentAlerts.Severities) { #| Where-Object { $_.Severity -NE $null }) {
193
+
$PSItem.Severity| Should -Be $PSItem.AgentAlertSeverity-Because "Recommended Agent Alerts to exists http://blog.extreme-advice.com/2013/01/29/list-of-errors-and-severity-level-in-sql-server-with-catalog-view-sysmessages/"
194
+
}
195
+
196
+
It "Severity <_.AgentAlertSeverity> Alert should be enabled on <_.InstanceName>"-Skip:$skipAgentAlerts-ForEach ($PSItem.AgentAlerts.Severities) {
197
+
$PSItem.IsEnabled| Should -Be $true-Because "Configured alerts should be enabled"
198
+
}
199
+
if ($AgentAlertJob) {
200
+
It "A job name for Severity <_.AgentAlertSeverity> Alert on <_.InstanceName>"-Skip:$skipAgentAlerts-ForEach ($PSItem.AgentAlerts.Severities) {
201
+
$PSItem.JobName-ne$null| Should -Be $true-Because "Should notify by SQL Agent Job"
202
+
}
203
+
}
204
+
if ($AgentAlertNotification) {
205
+
It "Severity <_.AgentAlertSeverity> Alert should have a notification on <_.InstanceName>"-Skip:$skipAgentAlerts-ForEach ($PSItem.AgentAlerts.Severities) {
206
+
$PSItem.HasNotification-in1,2,3,4,5,6,7| Should -Be $true-Because "Should notify by Agent notifications"
207
+
}
208
+
}
209
+
210
+
}
211
+
212
+
Context "Testing Agent Alerts MessageID exists on <_.Name>" {
213
+
It "MessageID <_.AgentMessageID> Alert should exist on <_.InstanceName>"-Skip:$skipAgentAlerts-ForEach ($PSItem.AgentAlerts.MessageIDs) {
214
+
$PSItem.MessageID| Should -Be $PSItem.AgentMessageID-Because "Recommended Agent Alerts to exists http://blog.extreme-advice.com/2013/01/29/list-of-errors-and-severity-level-in-sql-server-with-catalog-view-sysmessages/"
215
+
}
216
+
It "MessageID <_.AgentMessageID> Alert should be enabled on <_.InstanceName>"-Skip:$skipAgentAlerts-ForEach ($PSItem.AgentAlerts.MessageIDs) {
217
+
$PSItem.IsEnabled| Should -Be $true-Because "Configured alerts should be enabled"
218
+
}
219
+
if ($AgentAlertJob) {
220
+
It "A job name for MessageID <_.AgentMessageID> on <_.InstanceName>"-Skip:$skipAgentAlerts-ForEach ($PSItem.AgentAlerts.MessageIDs) {
221
+
$PSItem.JobName-ne$null| Should -Be $true-Because "Should notify by SQL Agent Job"
222
+
}
223
+
}
224
+
if ($AgentAlertNotification) {
225
+
It "MessageID <_.AgentMessageID> Alert should have a notification on <_.InstanceName>"-Skip:$skipAgentAlerts-ForEach ($PSItem.AgentAlerts.MessageIDs) {
226
+
$PSItem.HasNotification-in1,2,3,4,5,6,7| Should -Be $true-Because "Should notify by Agent notifications"
0 commit comments