File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,28 +68,32 @@ Describe $CommandName -Tag IntegrationTests {
6868 RECONFIGURE;
6969 GO"
7070
71+ 1 .. 20 | ForEach-Object {
72+ try {
73+ Remove-Item - Path $sqlFile - ErrorAction Stop
74+ return
75+ } catch {
76+ Start-Sleep - Seconds 1
77+ }
78+ }
7179 if (Get-Process sqlcmd - ErrorAction SilentlyContinue) {
7280 Write-Warning - Message " sqlcmd processes are still running. Attempting to stop them."
7381 Get-Process sqlcmd - ErrorAction SilentlyContinue | Stop-Process - Force
7482 }
75-
76- # remove sql file
77- Remove-Item - Path $sqlFile
83+ if ( Test-Path - Path $sqlFile ) {
84+ Write-Warning - Message " File $sqlFile could not be removed. "
85+ }
7886
7987 $PSDefaultParameterValues.Remove (" *-Dba*:EnableException" )
8088 }
8189
8290 Context " Can get an external process" {
8391 It " returns a process" {
84-
8592 1 .. 10 | ForEach-Object {
8693 $results = Get-DbaExternalProcess - ComputerName $computerName | Where-Object Name -eq " cmd.exe"
8794 if ($results ) { return }
8895 Start-Sleep - Milliseconds 500
8996 }
90- # Start-Sleep -Seconds 1
91- # $results = Get-DbaExternalProcess -ComputerName $computerName | Where-Object Name -eq "cmd.exe"
92- # Start-Sleep -Seconds 5
9397 $results.ComputerName | Should - Be $computerName
9498 $results.Name | Should - Be " cmd.exe"
9599 $results.ProcessId | Should -Not - Be $null
You can’t perform that action at this time.
0 commit comments