Skip to content

Commit 89c9931

Browse files
committed
Refactor error handling in Install-SqlDscServer integration tests to use Get-SqlDscSetupLog for better logging
1 parent 1aa8236 commit 89c9931

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

tests/Integration/Commands/Install-SqlDscServer.Integration.PrepareImage.Tests.ps1

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,7 @@ Describe 'Install-SqlDscServer - PrepareImage' -Tag @('Integration_SQL2017', 'In
6060
catch
6161
{
6262
# Output Summary.txt if it exists to help diagnose the failure
63-
$summaryFiles = Get-ChildItem -Path 'C:\Program Files\Microsoft SQL Server' -Filter 'Summary.txt' -Recurse -ErrorAction SilentlyContinue |
64-
Where-Object { $_.FullName -match '\\Setup Bootstrap\\Log\\' } |
65-
Sort-Object -Property LastWriteTime -Descending |
66-
Select-Object -First 1
67-
68-
if ($summaryFiles)
69-
{
70-
Write-Verbose "==== SQL Server Setup Summary.txt (from $($summaryFiles.FullName)) ====" -Verbose
71-
Get-Content -Path $summaryFiles.FullName | Write-Verbose -Verbose
72-
Write-Verbose "==== End of Summary.txt ====" -Verbose
73-
}
74-
else
75-
{
76-
Write-Verbose 'No Summary.txt file found.' -Verbose
77-
}
63+
Get-SqlDscSetupLog -Verbose | Write-Verbose -Verbose
7864

7965
# Re-throw the original error
8066
throw $_

0 commit comments

Comments
 (0)