Skip to content

Commit 6126624

Browse files
xtqqczzeiSazonov
authored andcommitted
Revise use of Start-Sleep cmdlet (#8633)
* Avoid use of sleep alias (follow-up to #8546) * Specify default parameter name * Shorten overly specific comments
1 parent 9d02e25 commit 6126624

8 files changed

Lines changed: 12 additions & 12 deletions

File tree

test/docker/networktest/DockerRemoting.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ Describe "Basic remoting test with docker" -tags @("Scenario","Slow"){
1616

1717
# give the containers something to do, otherwise they will exit and be removed
1818
Write-Verbose -verbose "setting up docker container PowerShell server"
19-
$server = docker run -d $imageName powershell -c start-sleep $timeout
19+
$server = docker run -d $imageName powershell -c Start-Sleep -Seconds $timeout
2020
Write-Verbose -verbose "setting up docker container PowerShell client"
21-
$client = docker run -d $imageName powershell -c start-sleep $timeout
21+
$client = docker run -d $imageName powershell -c Start-Sleep -Seconds $timeout
2222

2323
# get fullpath to installed core powershell
2424
Write-Verbose -verbose "Getting path to PowerShell core"

test/powershell/Language/Classes/Scripting.Classes.Attributes.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ Describe 'ValidateSet support a dynamically generated set' -Tag "CI" {
470470
It 'Can implement CachedValidValuesGeneratorBase with cache expiration in PowerShell' {
471471
Get-TestValidateSetPS5 -Param1 "TestString1" -ErrorAction SilentlyContinue | Should -BeExactly "TestString1"
472472
Get-TestValidateSetPS5 -Param1 "TestString1" -ErrorAction SilentlyContinue | Should -BeExactly "TestString1"
473-
Start-Sleep 3
473+
Start-Sleep -Seconds 3
474474
Get-TestValidateSetPS5 -Param1 "TestString2" -ErrorAction SilentlyContinue | Should -BeExactly "TestString2"
475475
}
476476
}

test/powershell/Modules/Microsoft.PowerShell.Core/Job.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Describe "Job Cmdlet Tests" -Tag "CI" {
4444
}
4545
Context "jobs which take time" {
4646
BeforeEach {
47-
$j = Start-Job -ScriptBlock { Start-Sleep 15 }
47+
$j = Start-Job -ScriptBlock { Start-Sleep -Seconds 15 }
4848
}
4949
AfterEach {
5050
Get-Job | Remove-Job -Force
@@ -93,7 +93,7 @@ Describe "Job Cmdlet Tests" -Tag "CI" {
9393
throw "Receive-Job behaves suspiciously: Cannot receive $n results in 5 minutes."
9494
}
9595

96-
# sleep for 300 ms to allow data to be produced
96+
# Wait to allow data to be produced
9797
Start-Sleep -Milliseconds 300
9898

9999
if ($keep)

test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1947,7 +1947,7 @@ try
19471947
Disconnect-PSSession $session
19481948
Start-Process powershell -arg 'Get-PSSession -cn localhost -name Session102 | Connect-PSSession' -Wait
19491949

1950-
Start-Sleep 3
1950+
Start-Sleep -Seconds 3
19511951

19521952
## This time a new session is created because the old one is unavailable.
19531953
$dSessionPid = Get-RemoteVariable pid

test/powershell/Modules/Microsoft.PowerShell.Utility/XMLCommand.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ Describe "XmlCommand DRT basic functionality Tests" -Tags "CI" {
5656
$ps = [PowerShell]::Create()
5757
$null = $ps.AddScript("1..10")
5858
$null = $ps.AddCommand("foreach-object")
59-
$null = $ps.AddParameter("Process", { $_; start-sleep 1 })
59+
$null = $ps.AddParameter("Process", { $_; Start-Sleep -Seconds 1 })
6060
$null = $ps.AddCommand("Export-CliXml")
6161
$null = $ps.AddParameter("Path", $testfile)
6262
$null = $ps.BeginInvoke()
63-
Start-Sleep 1
63+
Start-Sleep -Seconds 1
6464
$null = $ps.Stop()
6565
$ps.InvocationStateInfo.State | Should -Be "Stopped"
6666
$ps.Dispose()

test/tools/Modules/HelpersCommon/HelpersCommon.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function Wait-UntilTrue
1717
if (([DateTime]::Now - $startTime).TotalMilliseconds -gt $timeoutInMilliseconds) {
1818
return $false
1919
}
20-
# Sleep for the specified interval
20+
# Wait
2121
Start-Sleep -Milliseconds $intervalInMilliseconds
2222
}
2323
return $true

test/tools/Modules/HttpListener/HttpListener.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ Function Start-HTTPListener {
357357
{
358358
# ignore if listener is not ready
359359
}
360-
Start-Sleep -milliseconds 100
360+
Start-Sleep -Milliseconds 100
361361
}
362362
if (!$succeeded)
363363
{

test/tools/Modules/PSSysLog/PSSysLog.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ function Wait-UntilSuccess
938938
}
939939
}
940940

941-
# Sleep for the specified interval
941+
# Wait
942942
Start-Sleep -Milliseconds $intervalInMilliseconds
943943
}
944944
return $true
@@ -1073,7 +1073,7 @@ function Wait-PSWinEvent
10731073

10741074
    do
10751075
    {
1076-
        sleep $pause
1076+
        Start-Sleep -Seconds $pause
10771077

10781078
$recordsToReturn = @()
10791079

0 commit comments

Comments
 (0)