Skip to content

Commit 7b8c6e7

Browse files
SteveL-MSFTTravisEz13
authored andcommitted
fix intermittent failures in filesystem tests (#4566)
1 parent 813e4a6 commit 7b8c6e7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,16 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" {
203203

204204
Context "Validate behavior when access is denied" {
205205
BeforeAll {
206+
$powershell = Join-Path $PSHOME "powershell"
206207
if ($IsWindows)
207208
{
208-
$powershell = "powershell.exe"
209209
$protectedPath = Join-Path ([environment]::GetFolderPath("windows")) "appcompat" "Programs"
210210
$protectedPath2 = Join-Path $protectedPath "Install"
211211
$newItemPath = Join-Path $protectedPath "foo"
212212
}
213-
$errFile = "error.txt"
214-
$doneFile = "done.txt"
213+
$errFile = "$testdrive\error.txt"
214+
$doneFile = "$testdrive\done.txt"
215215
}
216-
217216
AfterEach {
218217
Remove-Item -Force $errFile -ErrorAction SilentlyContinue
219218
Remove-Item -Force $doneFile -ErrorAction SilentlyContinue
@@ -231,7 +230,7 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" {
231230

232231
runas.exe /trustlevel:0x20000 "$powershell -nop -c try { $cmdline -ErrorAction Stop } catch { `$_.FullyQualifiedErrorId | Out-File $errFile }; New-Item -Type File -Path $doneFile"
233232
$startTime = Get-Date
234-
while (((Get-Date) - $startTime).TotalSeconds -lt 5 -and -not (Test-Path $doneFile))
233+
while (((Get-Date) - $startTime).TotalSeconds -lt 10 -and -not (Test-Path $doneFile))
235234
{
236235
Start-Sleep -Milliseconds 100
237236
}

0 commit comments

Comments
 (0)