Revise use of Start-Sleep cmdlet (#8633)

* Avoid use of sleep alias (follow-up to #8546)
* Specify default parameter name
* Shorten overly specific comments
This commit is contained in:
xtqqczze 2019-01-15 00:31:52 -07:00 committed by Ilya
parent 9d02e254a1
commit 6126624b63
8 changed files with 12 additions and 12 deletions

View File

@ -16,9 +16,9 @@ Describe "Basic remoting test with docker" -tags @("Scenario","Slow"){
# give the containers something to do, otherwise they will exit and be removed
Write-Verbose -verbose "setting up docker container PowerShell server"
$server = docker run -d $imageName powershell -c start-sleep $timeout
$server = docker run -d $imageName powershell -c Start-Sleep -Seconds $timeout
Write-Verbose -verbose "setting up docker container PowerShell client"
$client = docker run -d $imageName powershell -c start-sleep $timeout
$client = docker run -d $imageName powershell -c Start-Sleep -Seconds $timeout
# get fullpath to installed core powershell
Write-Verbose -verbose "Getting path to PowerShell core"

View File

@ -470,7 +470,7 @@ Describe 'ValidateSet support a dynamically generated set' -Tag "CI" {
It 'Can implement CachedValidValuesGeneratorBase with cache expiration in PowerShell' {
Get-TestValidateSetPS5 -Param1 "TestString1" -ErrorAction SilentlyContinue | Should -BeExactly "TestString1"
Get-TestValidateSetPS5 -Param1 "TestString1" -ErrorAction SilentlyContinue | Should -BeExactly "TestString1"
Start-Sleep 3
Start-Sleep -Seconds 3
Get-TestValidateSetPS5 -Param1 "TestString2" -ErrorAction SilentlyContinue | Should -BeExactly "TestString2"
}
}

View File

@ -44,7 +44,7 @@ Describe "Job Cmdlet Tests" -Tag "CI" {
}
Context "jobs which take time" {
BeforeEach {
$j = Start-Job -ScriptBlock { Start-Sleep 15 }
$j = Start-Job -ScriptBlock { Start-Sleep -Seconds 15 }
}
AfterEach {
Get-Job | Remove-Job -Force
@ -93,7 +93,7 @@ Describe "Job Cmdlet Tests" -Tag "CI" {
throw "Receive-Job behaves suspiciously: Cannot receive $n results in 5 minutes."
}
# sleep for 300 ms to allow data to be produced
# Wait to allow data to be produced
Start-Sleep -Milliseconds 300
if ($keep)

View File

@ -1947,7 +1947,7 @@ try
Disconnect-PSSession $session
Start-Process powershell -arg 'Get-PSSession -cn localhost -name Session102 | Connect-PSSession' -Wait
Start-Sleep 3
Start-Sleep -Seconds 3
## This time a new session is created because the old one is unavailable.
$dSessionPid = Get-RemoteVariable pid

View File

@ -56,11 +56,11 @@ Describe "XmlCommand DRT basic functionality Tests" -Tags "CI" {
$ps = [PowerShell]::Create()
$null = $ps.AddScript("1..10")
$null = $ps.AddCommand("foreach-object")
$null = $ps.AddParameter("Process", { $_; start-sleep 1 })
$null = $ps.AddParameter("Process", { $_; Start-Sleep -Seconds 1 })
$null = $ps.AddCommand("Export-CliXml")
$null = $ps.AddParameter("Path", $testfile)
$null = $ps.BeginInvoke()
Start-Sleep 1
Start-Sleep -Seconds 1
$null = $ps.Stop()
$ps.InvocationStateInfo.State | Should -Be "Stopped"
$ps.Dispose()

View File

@ -17,7 +17,7 @@ function Wait-UntilTrue
if (([DateTime]::Now - $startTime).TotalMilliseconds -gt $timeoutInMilliseconds) {
return $false
}
# Sleep for the specified interval
# Wait
Start-Sleep -Milliseconds $intervalInMilliseconds
}
return $true

View File

@ -357,7 +357,7 @@ Function Start-HTTPListener {
{
# ignore if listener is not ready
}
Start-Sleep -milliseconds 100
Start-Sleep -Milliseconds 100
}
if (!$succeeded)
{

View File

@ -938,7 +938,7 @@ function Wait-UntilSuccess
}
}
# Sleep for the specified interval
# Wait
Start-Sleep -Milliseconds $intervalInMilliseconds
}
return $true
@ -1073,7 +1073,7 @@ function Wait-PSWinEvent
    do
    {
        sleep $pause
        Start-Sleep -Seconds $pause
$recordsToReturn = @()