Skip to content

Commit b508273

Browse files
committed
Fix severity levels in duplicate alert tests and ensure error handling is consistent
1 parent 7ded823 commit b508273

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/Integration/Commands/New-SqlDscAgentAlert.Integration.Tests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ END
117117

118118
It 'Should throw error when alert already exists' {
119119
# First create the alert
120-
$script:sqlServerObject | New-SqlDscAgentAlert -Name 'IntegrationTest_DuplicateAlert' -Severity 16 -ErrorAction Stop
120+
$script:sqlServerObject | New-SqlDscAgentAlert -Name 'IntegrationTest_DuplicateAlert' -Severity 15 -ErrorAction Stop
121121

122122
# Try to create it again - should throw
123-
{ $script:sqlServerObject | New-SqlDscAgentAlert -Name 'IntegrationTest_DuplicateAlert' -Severity 14 } |
123+
{ $script:sqlServerObject | New-SqlDscAgentAlert -Name 'IntegrationTest_DuplicateAlert' -Severity 14 -ErrorAction Stop } |
124124
Should -Throw
125125
}
126126

127127
It 'Should throw error when both Severity and MessageId are specified' {
128-
{ $script:sqlServerObject | New-SqlDscAgentAlert -Name 'IntegrationTest_InvalidAlert' -Severity 16 -MessageId 50001 } |
128+
{ $script:sqlServerObject | New-SqlDscAgentAlert -Name 'IntegrationTest_InvalidAlert' -Severity 16 -MessageId 50001 -ErrorAction Stop } |
129129
Should -Throw
130130
}
131131
}

0 commit comments

Comments
 (0)