Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-RandomTempRegistry: Test-Path : No more data is available #2418

Open
3 tasks done
chrisdent-de opened this issue Jan 8, 2024 · 2 comments
Open
3 tasks done

New-RandomTempRegistry: Test-Path : No more data is available #2418

chrisdent-de opened this issue Jan 8, 2024 · 2 comments

Comments

@chrisdent-de
Copy link

Checklist

What is the issue?

When Pester 5 is running in parallel the Test-Path invocation in New-RandomTempRegistry will occasionally throw No more data is available.

This error is already handled with a retry for New-Item, but not the Test-Path command.

Expected Behavior

The TestRegistry drive should successfully create.

Steps To Reproduce

Cannot trivially reproduce this transient error.

Stack trace is shown below:

Running tests from 'SomeTests.Tests.ps1'�[0m
PS>TerminatingError(Test-Path): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: No more data is available.
"
>> TerminatingError(Test-Path): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: No more data is available.
"
>> TerminatingError(Test-Path): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: No more data is available.
"
>> TerminatingError(Test-Path): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: No more data is available.
"
Framework failed:
Result :Error :Test-Path : No more data is available.

...\pester\Pester.psm1:15947 char:20
+ ... ntil (-not (& $SafeCommands['Test-Path'] -Path $Path -PathType Contai ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ReadError: (HKEY_CURRENT_US...8d-5e6a300e12fc:String) [Test-Path], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.TestPathCommand
 
New-RandomTempRegistry, ...\pester\Pester.psm1: line 15946
New-TestRegistry, ...\pester\Pester.psm1: line 15868
<ScriptBlock>, ...\pester\Pester.psm1: line 16009
<ScriptBlock>, ...\pester\Pester.psm1: line 1985
<ScriptBlock>, ...\pester\Pester.psm1: line 1959
Invoke-ScriptBlock, ...\pester\Pester.psm1: line 2123
Invoke-Block, ...\pester\Pester.psm1: line 856
<ScriptBlock>, ...\pester\Pester.psm1: line 1672
<ScriptBlock>, ...\pester\Pester.ps1: line 3
<ScriptBlock>, ...\pester\Pester.psm1: line 3164
Invoke-InNewScriptScope, ...\pester\Pester.psm1: line 3171
Run-Test, ...\pester\Pester.psm1: line 1675
Invoke-Test, ...\pester\Pester.psm1: line 2475
Invoke-Pester<End>, ...\pester\Pester.psm1: line 5272
<ScriptBlock>, ...\TaskInvoker.ps1: line 116

Describe your environment

A CI executor which runs multiple instances of Pester in parallel in PowerShell 5.1.

The error does not occur in PowerShell 7.3 and above.

Possible Solution?

Are you happy to accept a PR which modifies the retried operation in New-RandomTempRegistry?

@fflaten
Copy link
Collaborator

fflaten commented Feb 7, 2024

Thanks for the report. Are you still experiencing this? If so, we'd appreciate a PR.

I hope it's the last one for this mysterious behavior, but we might need this for all read operations in TestRegistry.ps1 as it's a known issue in .NET Framework (fixed in .NET/Core)

@chrisdent-de
Copy link
Author

Sorry, just been a bit busy. I'm planning to PR a more extensive retry op around this. In the meantime I've disabled TestRegistry drive so the pressure to fix went off a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants