Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tests/Get-DbaExternalProcess.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,17 @@ Describe $CommandName -Tag IntegrationTests {
GO"

# remove sql file
Remove-Item -Path $sqlFile
foreach ($run in 1..20) {
try {
Remove-Item -Path $sqlFile -ErrorAction Stop
break
} catch {
Start-Sleep -Seconds 1
}
}
if (Test-Path -Path $sqlFile) {
Write-Warning -Message "File $sqlFile could not be removed."
}

$PSDefaultParameterValues.Remove("*-Dba*:EnableException")
}
Expand All @@ -78,7 +88,6 @@ Describe $CommandName -Tag IntegrationTests {
It "returns a process" {
Start-Sleep -Seconds 1
$results = Get-DbaExternalProcess -ComputerName $computerName | Where-Object Name -eq "cmd.exe"
Start-Sleep -Seconds 5
$results.ComputerName | Should -Be $computerName
$results.Name | Should -Be "cmd.exe"
$results.ProcessId | Should -Not -Be $null
Expand Down
13 changes: 11 additions & 2 deletions tests/Stop-DbaExternalProcess.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,17 @@ Describe $CommandName -Tag IntegrationTests {
GO"

# remove sql file
Remove-Item -Path $sqlFile
foreach ($run in 1..20) {
try {
Remove-Item -Path $sqlFile -ErrorAction Stop
break
} catch {
Start-Sleep -Seconds 1
}
}
if (Test-Path -Path $sqlFile) {
Write-Warning -Message "File $sqlFile could not be removed."
}

$PSDefaultParameterValues.Remove("*-Dba*:EnableException")
}
Expand All @@ -79,7 +89,6 @@ Describe $CommandName -Tag IntegrationTests {
It "returns results" {
Start-Sleep -Seconds 1
$results = Get-DbaExternalProcess -ComputerName $computerName | Select-Object -First 1 | Stop-DbaExternalProcess
Start-Sleep -Seconds 5
$results.ComputerName | Should -Be $computerName
$results.Name | Should -Be "cmd.exe"
$results.ProcessId | Should -Not -BeNullOrEmpty
Expand Down
Loading