Skip to content

Commit e861d45

Browse files
committed
Suppress error output during audit cleanup by assigning command results to $null
1 parent 36a290a commit e861d45

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,7 @@ Describe 'New-SqlDscAudit' -Tag @('Integration_SQL2017', 'Integration_SQL2019',
5656

5757
foreach ($audit in $testAudits)
5858
{
59-
try
60-
{
61-
Remove-SqlDscAudit -AuditObject $audit -Force -ErrorAction 'SilentlyContinue'
62-
}
63-
catch
64-
{
65-
# Ignore cleanup errors
66-
}
59+
$null = Remove-SqlDscAudit -AuditObject $audit -Force -ErrorAction 'SilentlyContinue'
6760
}
6861

6962
Disconnect-SqlDscDatabaseEngine -ServerObject $script:serverObject

0 commit comments

Comments
 (0)